ken.mayfield Posted June 30, 2011 Posted June 30, 2011 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?
manguste Posted July 1, 2011 Posted July 1, 2011 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.
ken.mayfield Posted July 2, 2011 Author Posted July 2, 2011 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?
steve3d Posted July 3, 2011 Posted July 3, 2011 I also have this problem, see attached file UV map 2 in perfectly matched the lightmap in resource editor. but the result in engine editor is totally wrong. I've sended the mail to support@unigine.com
frustum Posted July 3, 2011 Posted July 3, 2011 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.
steve3d Posted July 3, 2011 Posted July 3, 2011 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?
frustum Posted July 3, 2011 Posted July 3, 2011 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.
steve3d Posted July 3, 2011 Posted July 3, 2011 Thank you frustum, After I scaled the lightmap to this All rendered fine. Tomorrow I'll modify the export plugin to scale the second uv channel by (0.5,0.5) Thank you again.
ken.mayfield Posted July 3, 2011 Author Posted July 3, 2011 You'll need to scale by 2, not 0.5. I just gave it a try, and it works.
steve3d Posted July 3, 2011 Posted July 3, 2011 enlarge the lightmap by size of 2, equals scale down the whole uv chanel by 0.5 :rolleyes:
steve3d Posted July 4, 2011 Posted July 4, 2011 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:
steve3d Posted July 5, 2011 Posted July 5, 2011 :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 ?
frustum Posted July 15, 2011 Posted July 15, 2011 The global console variable "render_use_directional_lightmap" will be added.
ken.mayfield Posted July 15, 2011 Author Posted July 15, 2011 The global console variable "render_use_directional_lightmap" will be added. Is this coming in the next update? Or planned for the future?
frustum Posted July 15, 2011 Posted July 15, 2011 Is this coming in the next update? Or planned for the future? Will be available in the upcoming update.
ken.mayfield Posted August 8, 2011 Author Posted August 8, 2011 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?
ken.mayfield Posted August 8, 2011 Author Posted August 8, 2011 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.
Recommended Posts