Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, dpn), 1,328 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 4 of 14 1 2 3 4 5 6 13 14
Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: ventilator] #119555
03/31/07 18:34
03/31/07 18:34
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
ahm... just to your info: this is exactly what the static mesh support in a7 is supposed to do. so if you wait some months, you#ll get it with a7.

the greatest disadvantage would be that the shadows are only baked, move the chair in franks example and the scene will look odd. so this metod would only be good for an unchanging lighting situation in combination with immovable objects. rather limited, if you ask me.

Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: broozar] #119556
03/31/07 18:59
03/31/07 18:59
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
I think external modelling applications will always do a better job at lighting a scene than WED. For example WED shadows don't have realistic penumbrae.

Quote:

the greatest disadvantage would be that the shadows are only baked, move the chair in franks example and the scene will look odd. so this metod would only be good for an unchanging lighting situation in combination with immovable objects. rather limited, if you ask me.



The same goes for the upcoming static mesh support, exept that static meshes truely CAN'T be moved.

Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: Excessus] #119557
03/31/07 21:13
03/31/07 21:13
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Ok everyone! Good news!

I dived into D3D and it's really not all that hard

I have found a way to do this and maybe I can release a rough plugin as soon as tomorow. A touched up version should be done at the end of the next weekend. I have exams next week, so I can't work on this during the week..

What I've got now:
A plugin that can copy the normal UV Map to the second UV map. I can test this with two small shaders that use either TEXCOORD0 or TEXCOORD1 for texture lookup. When I launch my app, the warlock looks normal with the TEXCOORD0 shader, and messed up with the TEXCOORD1 shader. If I call my plugin function, the TEXCOORD1 shader will look correct (because the TEXCOORD0 was copied there).

So the only thing left to do is write a function that can read in the UV coord, instead of copying the first UV.. I hope the skin points exported by 'export skin mapping' in MED are in the right order, or I will have to come up with something clever..

@Ventilator: the vertex format used by 3DGS already has 3(!) texture coords per vertex, thus no need to duplicate vertices.

EDIT: could someone (frank?) send me a model with 2 UV maps and a shadow map? You could send one .mdl with a normal diffuse texture and the normal skin mapping, and another one with the shadowmap and different UV mapping. My email is taco dot cohen at gmail dot com.

Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: Excessus] #119558
03/31/07 21:35
03/31/07 21:35
Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
Machinery_Frank Offline
Senior Expert
Machinery_Frank  Offline
Senior Expert

Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
Thanks for looking into that!


Models, Textures and Games from Dexsoft
Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: Machinery_Frank] #119559
03/31/07 22:28
03/31/07 22:28
Joined: Nov 2003
Posts: 1,659
San Francisco
JetpackMonkey Offline
Serious User
JetpackMonkey  Offline
Serious User

Joined: Nov 2003
Posts: 1,659
San Francisco
brilliant! Very exciting news, Taco

Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: Excessus] #119560
03/31/07 22:55
03/31/07 22:55
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
Quote:

@Ventilator: the vertex format used by 3DGS already has 3(!) texture coords per vertex, thus no need to duplicate vertices.


yes, there are 3 texture coordinates in the vertex struct but this doesn't solve the problem in any way. you will notice it once you get real model data to play with. if the seams of the first uv-set and the seams of the second uv-set aren't the same then you will have to duplicate vertices. for light maps with their automatic atlas mapping they very likely won't be the same.

<edit>
with seams i mean the borders of the uv-patches. look at maybenew's example or here:



the light map uvs on the right have a lot more seams/borders. in this example the mesh has 24 vertices, the texture uv-map has 24 uv-vertices (but this is just a coincidence - most of the time the number won't be the same) and the light map uv-map has 72 uv-vertices if i counted them correctly. so how will you store them in a vertex buffer which contains only 24 vertices? you need to duplicate the vertices correctly!
</edit>

but it would be nice if you could post your source code so far since my first tries showed that i seem to be too stupid even for the most basic direct3d buffer stuff. maybe some of my problems are related to lite-c though. for example d3d9.h doesn't seem to be very complete.

Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: ventilator] #119561
04/01/07 06:12
04/01/07 06:12
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
I knew it couldn't be that easy or someone would have done it !

So I understand the core of the problem now: a vertex can have multiple skin points, even on a single UVmap. Ofcourse..

I wonder, though.. If you where to edit the mesh, breaking vertices everywhere, wouldn't that affect the shading? When a vertex (in 3D space, not on the UV) is duplicated its normal cannot be interpolated and you will get 'flat shading'. Maybe this just isn't a problem when all the lighting is in the skin anyway?

I looked in the sampledll and it uses d3dx9.h not d3d9.h. This file is included in the directX SDK, which you can download from microsoft. The code I have so far (quick and dirty without much error handling):
Code:

DLLFUNC var assignUV(ENTITY* ent)
{
if (!ent) return 0;

LPD3DXMESH entMesh = (LPD3DXMESH)ent_mesh(ent, 0);
int numVertices = _INT(ent_vertices(ent));

VERTEX* pVerts = NULL;
entMesh->LockVertexBuffer(0, reinterpret_cast<void**> (&pVerts));

for(int i = 0; i < numVertices; i++)
{
//pVerts[i].tu2 = pVerts[i].tu1; // Copy v1 to v2
//pVerts[i].tv2 = pVerts[i].tv1;
//pVerts[i].tu1 = 0.0f;
//pVerts[i].tv1 = 0.0f;

pVerts[i].tu2 = 0.0f; // alternative: empty v2 (seems to contain v1 usually)
pVerts[i].tv2 = 0.0f;

}

entMesh->UnlockVertexBuffer();
return _VAR(1);

}



pVerts is just a pointer, so using [] translates to pointer arithmetic. It's the same as &(pVerts + i), it moves the pointer ahead i * sizeof(VERTEX) each time (sorry if you knew this, I have no idea of your C++ skill but I thought this was pretty smart ).

Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: Excessus] #119562
04/01/07 11:52
04/01/07 11:52
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
the vertex struct also contains the normal. the normals of broken vertices could all point in the same direction so shading shouldn't get affected. but there are cases when the normals get recalculated (ent_fixnormals(),...) and i am not sure how this could get handled. maybe there is some other additional buffer which contains information about which broken vertices should be handled as a single vertex.

thanks for posting your example! i think i understand how arrays and pointers relate to each other but a reminder is always good since i still sometimes make mistakes with it.

my example from yesterday looks similar. not sure what's wrong with it but i will experiment...

Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: ventilator] #119563
04/02/07 14:55
04/02/07 14:55
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
Quote:

[...] pVerts is just a pointer, so using [] translates to pointer arithmetic. It's the same as &(pVerts + i), [...]


don't you mean *(pVerts + 1) instead of &(pVerts + 1)?

darn, i still didn't succeed in getting my example working in lite-c.

Re: [Plugin] Import von 2. UVMap / Import of 2nd U [Re: ventilator] #119564
04/03/07 14:05
04/03/07 14:05
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Quote:

don't you mean *(pVerts + 1) instead of &(pVerts + 1)?



Oh yea, ofcourse. As you can see I'm still sometimes making errors with pointers aswell.

Have you tried to copy/paste my code in lite-c? I don't know what the problem could be as I've not used lite-c extensively yet. My code doesn't use any C++ specific constructs, so you should be able to use it in lite-c aswell (maybe remove the type conversion macros).

Do you need this for your newton plugin, or for this plugin? Are you planning on doing this plugin, once you get the hang of d3d? I've given the algorithm some thought and I must admit it hurts my brain.

Page 4 of 14 1 2 3 4 5 6 13 14

Moderated by  checkbutton, Inestical, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1