Home Technical Talk

[3DS Max] Lightmap + DirectX Shader issues.

polycounter lvl 13
Offline / Send Message
< ASH > polycounter lvl 13
Hi everyone,

I am reading Polycount since a long while, but it’s my very first thread. :)

I am struggling to have the lightmaps working properly in the 3DS Max viewport of a low poly environment I am working on.

Every object of the scene has a Diffuse texture (UV set Channel 1) and a Lightmap texture (UV set Channel 2).

Rendering wise I had no big issue to create the shading network. I am using a Standard material that within the Diffuse slot has a Composite node with 2 layers: on top layer the Lightmap texture in Multiply and on the lower layer the Diffuse texture in Normal.
If you have a look to the screenshots here you can see how I created this shading network for a prop (the Fork Lift).
Composite Shader page 1: http://img101.imageshack.us/img101/8358/2compositeshader1.jpg
Composite Shader page 2: http://img824.imageshack.us/img824/4470/2compositeshader2.jpg

This system is working pretty well for all the object of the scene (even if not well as in Maya), but just when I render the scene. In real time the lightmap effect is not visible using this technique.

Because I have to show as well the environment in real time in the 3D viewport, I tried to figure out a way to use a real time shader to display the lightmaps effect in viewport.
I thought that using a Shell material I can keep a shading network for the rendering and I can create another shading network for the real time view.

Shell Material: http://img62.imageshack.us/img62/8084/1shelmat.jpg

At the beginning I thought to use the Xoliul Shader, that I read around is pretty powerfull, but I cannot figure out where to map the lightmap texture and where to select the right UV Channel for the lightmap within the shader settings (maybe someone knows it and could be so kind to enlight me!).

So I decided to try with the DirectX Shader found within 3DS Max even if I read around that is not always working properly and in fact I am having 2 different kinds of issues.
I tried to use the DirectX shader in 2 different ways:

1) I created a DirectX shader material and selected the LightMap Technique (loading the lightmap.fx shader): I loaded the Diffuse texture in UV Channel 1 and the Lightmap texture in UV Channel 2.
At this point I got 2 different results: on the Asphalt geometry (that is a flat plane) the shader is working … but on most complicated object (like the forklift) the object turn invisible as long as I set the light map to the UV channel #2 (by default is set on channel #4). So it seems I can use this shader just for the terrain geometry. But I had to figure out something else for the rest of the assets.

DirectX Shader material pag 1: http://img233.imageshack.us/img233/2812/dxsasphalt1.jpg

DirectX Shader material pag 2:http://img16.imageshack.us/img16/321/dxsasphalt2.jpg

2) So I tried to create a Standard Shader and then within the DirectX Manager settings of the material I select the "LightMap" setting and I assigned the Diffuse texture in UV set Channel 1 and the Lightmap texture in UV set Channel 2.

Standard Material with DirectX Shader: http://img13.imageshack.us/img13/9691/3standarddirectxshader.jpg

But even here I got a problem: if I keep the object selected the shader is working, but as long as I deselect the object the lightmap UV channel go crazy (or it looks like that): it seems that the lightmap UV channel get the UV channel 1 (instead of the UV channel #2 as it should be) as long as I deselect the object. But there’s an interesting thing to note: if I enable the Edged Faces (pressing F4) the shader restart to work properly.

Oh by the way I forgot to attach also the screnshot of the issue itself. :poly142:

With Edged Faces not displayed and not selected the DirectX Shader is not working: http://img29.imageshack.us/img29/1563/notselected.jpg

With Edged Faces selected but not displayed (without having pressed F4) the DirectX Shader is working: http://img202.imageshack.us/img202/4559/selectedandedgedfacesdi.jpg

With Edged Faces displayed (pressing F4) but not selected the DirectX Shader is working: http://img10.imageshack.us/img10/3999/edgedfacesdisplayed.jpg


I searched an answer for hours on the internet but I didn’t managed to find any possible solution to this issue and I don’t have any other idea about how to solve the issue or which other technique or shader to use to have the lightmap working correctly in real time in the 3DS Max viewport.
Let me know if you need more info to understand the problem
Any criticism, suggestion or help would be welcome.


Thanks in advance. :D

Ash / Andrea

Replies

  • < ASH >
    Options
    Offline / Send Message
    < ASH > polycounter lvl 13
    Oh by the way I forgot to attach also the screnshot of the issue itself. :poly142:

    I added them to the original post so is easyer to follow. :)
  • < ASH >
    Options
    Offline / Send Message
    < ASH > polycounter lvl 13
    Nobody could help? :(

    If not to fix the issue I described at least any idea about an alternative way I can use to show the lightmaps in real time (maybe not using the direct X Shader).
  • Eric Chadwick
    Options
    Offline / Send Message
    That's a looong first post! :) But it's great because you give a lot of information.

    It sounds like Max's lightmap shader might be at fault. I would recommend taking a look at Shader FX. It's a free tool (for non-commercial use) that helps you create DirectX shaders in 3ds Max. http://www.lumonix.biz/shaderfx.html It also comes with some great sample shaders.
  • < ASH >
    Options
    Offline / Send Message
    < ASH > polycounter lvl 13
    Hey Eric, thanks for the answer! :thumbup:

    I will have a go with the Shader FX you suggested.
    Having a first fast look to the features of the shader it seems to be really handy and powerfull.
    A doubt I have about the shader is that: if I will send the 3DS max file to someon else I will have to provide the .fx file of the shader as well or the shader will work automatically because has been saved withing the 3ds max file?

    Thanks again for your nice answer btw! ;)

    PS
    I am aware that at the first glimpse the post looks (and it is) terribly long, but I thought was better to provide as many details as possible immediately instead of having people asking for futher details later on. :)
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    You can save out the FX file, just make sure it's in the same folder as with all the images.
  • < ASH >
    Options
    Offline / Send Message
    < ASH > polycounter lvl 13
    Ace-Angel wrote: »
    You can save out the FX file, just make sure it's in the same folder as with all the images.

    Brilliant, thanks for the info ! :thumbup: :)
  • < ASH >
    Options
    Offline / Send Message
    < ASH > polycounter lvl 13
    Finally I understood how to fix the original problem (the incorrect display of the DirectX Material when deselecting the mesh without the Edged Faces displayed).
    Apparently the reason was that the option "Shaded", that lies within the "Object Properties" tab of each mesh, was disabled: once enabled it the DirectX material started to work properly. :)

    issuefixed.jpg
Sign In or Register to comment.