Jump to content

[SOLVED] Custom lightmap problem


photo

Recommended Posts

Adding a custom lightmap is giving me some problems. For demonstration reasons, I made the unique 2nd UV identical to the first (see screenshot). The lightmap used in the diffuse channel uses the UV's correctly (see in the corners). In the lightmap channel, the mesh is stretched all over (see bad corruption).

 

Is there a way I can add lightmaps and have them working as the do in the diffuse channel in my example?

Link to comment

Please export the node (a model together with its material and textures) and send it at support@unigine.com. Otherwise, it is hard to say what the cause of your problem is.

Link to comment

It appears that my pre-rendered lightmap UV's are spanning the entire texture, whereas Unigine baked lightmaps have 4 different lightmaps tiled 2x2 in the texture. Is there a way I can set it use UV's that span the whole texture?

Link to comment

I also have this problem, see attached file

 

post-49-0-79065900-1309679153_thumb.jpg

UV map 2 in perfectly matched the lightmap in resource editor.

 

post-49-0-00634100-1309679160_thumb.jpg

but the result in engine editor is totally wrong.

 

I've sended the mail to support@unigine.com

Link to comment

Use vec4(0.5f,0.5f,0.0f,0.0f) lightmap texture coordinates transformation in material. Or tile lightmap texture in 2x2 pattern.

Unigine uses four directional ligtmaps in following pattern:

 

UL UR

 

BL BR

 

UL is (0.0 0.0 1.0) direction

UR is (0.816496 0.0 0.577350) direction

BL is (-0.408248 0.707106 0.577350) direction

BR is (-0.408248 -0.707106 0.577350) direction

 

On low shaders quality only UL quadrant is used.

On medium and high shaders quality all quadrants are used and they are sampled in according to normalmap.

Link to comment

how to set the lightmap transform in material? seems there is no such setting.

 

and tile the lightmap, how? if tile lightmap, does this means if the original lightmap is 1024x1024, then I have to make the lightmap 2048x2048 then make the lightmap to

M M

M M

this format?

Link to comment

how to set the lightmap transform in material? seems there is no such setting.

 

and tile the lightmap, how? if tile lightmap, does this means if the original lightmap is 1024x1024, then I have to make the lightmap 2048x2048 then make the lightmap to

M M

M M

this format?

 

My fault. There is no material lightmap transform parameter. Scale second UV channel in your 3D software as workaround.

 

Yep 1024x1024 lightmap transforms to 2048x2048.

Link to comment

Thank you frustum, After I scaled the lightmap to this post-49-0-36289800-1309711038_thumb.jpg

All rendered fine.

 

Tomorrow I'll modify the export plugin to scale the second uv channel by (0.5,0.5)

 

Thank you again.

Link to comment

well, scale down the whole uv channel doesn't work, so this means I have to waste 3/4 pixels of lightmap rendered in 3d application. :rolleyes:

Link to comment

:rolleyes: in order to use the whole lightmap texture directly from 3dsmax, I have to hack the data\core\shaders\default\common\fragment_base.h, directly use the low quality statement.

 

If unigine can add a switch of this, use directly rendered lightmap from 3d application, or use lightmap genertated from engine with 2x2 patten, then it will be much useful, add this swith is a easy task, is that right, frustum ?

Link to comment
  • 2 weeks later...

The global console variable "render_use_directional_lightmap" will be added.

 

Is this coming in the next update? Or planned for the future?

Link to comment
  • 4 weeks later...

Using "render_use_directional_lightmap" on mobile does not seem to be working, but it works great on PC. I'm trying to set it in the config file, would this be the correct place to do this?

Link to comment

Nevermind this, I just copied your text from above, and it was missing the "s" at the end of "lightmap". Adding the s makes it work just right.

Link to comment
×
×
  • Create New...