Hello everyone,
New to LuxCoreRender but really liking it so far.
I have a quick question about normal maps. I assume luxcore takes OpenGL as it is default for Blender. Am I correct? Is there way to change DirectX to OpenGL inside luxcore. I'm sorry if this was discussed before but my quick search didn't find any info.
I appreciate your help since I'm switching my workflow from Cycles to LuxCore for many reasons.
Normal Map DirectX to OpenGL
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Re: Normal Map DirectX to OpenGL
I'm not sure what you mean.
Blender uses OpenGL to draw its UI, and the Blender addon uses OpenGL in some places through Blender's API (bgl wrapper), for example to draw the viewport render or to show the point light radius. But it does not concern normal maps - they are handled internally in LuxCore with the usual C++/OpenCL code that is used for rendering.
Also, we can't switch our addon to DirectX - this would be a job for the Blender developers.
Maybe you can describe in more detail what you are after?
Blender uses OpenGL to draw its UI, and the Blender addon uses OpenGL in some places through Blender's API (bgl wrapper), for example to draw the viewport render or to show the point light radius. But it does not concern normal maps - they are handled internally in LuxCore with the usual C++/OpenCL code that is used for rendering.
Also, we can't switch our addon to DirectX - this would be a job for the Blender developers.
Maybe you can describe in more detail what you are after?
Re: Normal Map DirectX to OpenGL
Hi B.Y.O.B.,
Thanks for your quick reply.
I sometimes use Unreal Engine, which takes DirectX normal maps so I have some those normal maps. When I use them in Cycles, I just invert green channel using nodes. (In Corona exporter, it has a option to choose either OpenGL or DirectX). I was wondering if I could do that in LuxCore.
Hope this makes sense to you.
Thanks for your quick reply.
I sometimes use Unreal Engine, which takes DirectX normal maps so I have some those normal maps. When I use them in Cycles, I just invert green channel using nodes. (In Corona exporter, it has a option to choose either OpenGL or DirectX). I was wondering if I could do that in LuxCore.
Hope this makes sense to you.
Re: Normal Map DirectX to OpenGL
That's the first time I hear about normal maps with inverted green channel.
I think the best (also for rendering performance) is to fix the map in an image editing program. If you invert the channel via shader nodes it's going to hurt the runtime rendering performance.
Currently we have no nodes to split/combine colors (it's planned however).
But you can invert one channel by subtracting it from 1 (and from 0 for the others) and then taking the absolute to fix the now negative other channels.
E.g. if you want to invert the green channel, subtract your color from (0, 1, 0) and take the absolute.
In BlendLuxCore, the standalone normalmap node is not available through the add node menu because it's not really needed in 99.99% of cases.
In a case like yours, it can be added via the Python console:
You just have to enter the correct material name.
Note that you have to set the gamma of your imagemap to 1.
The "subtract" and "absolute" nodes are created via Add -> Utils -> ColorMix, then choosing the type from the dropdown.
Then you can create a node setup like this to do what you need:
I think the best (also for rendering performance) is to fix the map in an image editing program. If you invert the channel via shader nodes it's going to hurt the runtime rendering performance.
Currently we have no nodes to split/combine colors (it's planned however).
But you can invert one channel by subtracting it from 1 (and from 0 for the others) and then taking the absolute to fix the now negative other channels.
E.g. if you want to invert the green channel, subtract your color from (0, 1, 0) and take the absolute.
In BlendLuxCore, the standalone normalmap node is not available through the add node menu because it's not really needed in 99.99% of cases.
In a case like yours, it can be added via the Python console:
Code: Select all
D.node_groups['Your material name'].nodes.new("LuxCoreNodeTexNormalmap")
Note that you have to set the gamma of your imagemap to 1.
The "subtract" and "absolute" nodes are created via Add -> Utils -> ColorMix, then choosing the type from the dropdown.
Then you can create a node setup like this to do what you need:
Re: Normal Map DirectX to OpenGL
Ok, I think for now it's easier to just use Photoshop to flip the green channel. I really appreciate your detailed answer though. Thanks
Re: Normal Map DirectX to OpenGL
B.Y.O.B
Thanks for showing how create a normal map with a subtracted colour - really useful!
Cheers
Thanks for showing how create a normal map with a subtracted colour - really useful!
Cheers
Re: Normal Map DirectX to OpenGL
We have the support for image maps pre-processing for stuff like using the a single RGB channel or using the average, etc. We can add also this "DirectX to OpenGL" translation (aka right-handed to left-handed normal maps ) if it is something may be useful for more people
Re: Normal Map DirectX to OpenGL
I think the "DirectX to OpenGL" choice would be handy; if you are downloading textures you don't know what you are getting
Re: Normal Map DirectX to OpenGL
Yes, that'd be very handy. Preferably inside texture node. So once you select "Normalmap" box, there will be a choice of either OpenGL or DirectX
By the way, you guys are doing a great job with this engine. I really think LuxCore deserves more attention. Keep up your great work!!
By the way, you guys are doing a great job with this engine. I really think LuxCore deserves more attention. Keep up your great work!!