Sign in to follow this  
jdyyx1984

does the same static object in the scene have the same lightmap uv coordinate?

Recommended Posts

for example , i put 3 instances of a static mesh in the level, should i use the same lightmap uv coordinate for them and  then pack the 3 square block into one lightmap atlas texture, or complete different lightmap  uv coordinate for each one so that  the atlas texture can be more compact, but the latter one also need more vertex memory because the lightmap uv coordinate can not be reused by different instances with the same mesh type

Share this post


Link to post
Share on other sites

I'm not sure what you actually mean ( your statements sound a bit contradictory to me ), but I'm afraid that you can not reuse anything along different instances of a mesh, when it comes to lighting them using a lightmap. They occupy different places and orientations in space, so they must be lit differently by the lights in the scene.

Share this post


Link to post
Share on other sites

i'm sorry for my descriptionsad.png  

here is my vertex format 

 

struct MeshVertex

{

float3 pos:POSITION

float3norm:NORMAL

float2 tex_diffuse:TEX0

float2 tex_lightmap:TEX1  

}

 

every vertex of a mesh has two uv coordinates ,one for texture one for lightmap , now i have 2 solutions:

1. generate the lightmap uv of each mesh type by 3DMAX , during the lighting building  process i just pack 3 single lightmap into a big atlas texture ,so each instance just need a uv offset and  uv scale to the atlas texture to get its corresponding lightmap data area . 

2.  pack all instances into a single mesh  and generate a lightmap coordinate set for  that big mesh and then distribute the corresponding subset to each instance  after level design has been finished in the level editor.so , the uv space of lightmap can be more compact than the former one.An obvious drawback of it is the  extra vertex buffer needed for each instance and some extra vertex stream stat change during rending

 

which one is better?

Edited by jdyyx1984

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