Sign in to follow this  
Tiresias

texturing weapons/armors noob question

Recommended Posts

Tiresias    117
Hi Gurus!

i a total noob in graphics theory so please be indulgent.

I have a question concerning how i shall implement object (weapons and armors to be exact) texturing.

i.e : lest assume we have 2 weapon meshes. There is 10 matters available for those 2 weapons. The UV map for a weapon is the same for any matters.

Shall we:

1- have 2*10 "weapon object resources" (maya or whatever) stored somewhere, one per matter per weapon (so 2 weapons * 10 matters)

2. or shall we texture the weapon in real time in code using its UV map + texture file , in this case we will have 2 weapon meshes, 2*1 UV (one UV mapping per weapon wathever the matter is), and 10 texture files.

If this is 2, what would be pseudo code (independently of the game engine, like pointing out the 3d resources involved for the texturing: weapon mesh, uv and texture)

Thanks , sorry if this doesnt make too much sense.

Share this post


Link to post
Share on other sites
tanzanite7    1410
[quote name='Tiresias' timestamp='1339082626' post='4947065']
Thanks , sorry if this doesnt make too much sense.
[/quote]
It definitely is challenging to make sense out of it, but i try:

[quote name='Tiresias' timestamp='1339082626' post='4947065']
If this is 2, what would be pseudo code (independently of the game engine, like pointing out the 3d resources involved for the texturing: weapon mesh, uv and texture)
[/quote]
It generally goes like this:
* load the vertex data (pos/normal/texcoord/whatever-else) and upload to GPU (vertex/index-buffers).
* load the textures
* load the shaders
... ie, they are separate things (usually, but definitely not always, vertex data contains no "material" data and is hence independent)

To render:
* draw object using the shader / texture / vertex-buf set your particular object needs and draw it.

Sort state per shader first, vertex/index-buf (use one buffer for multiple meshes) and texture next.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this