Wrong Diffuse color with Bump in new luxCore 2.4 and up

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Post Reply
User avatar
TAO
Developer
Developer
Posts: 851
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by TAO »

I notice if I render any type of bump with matte material sometimes the diffuse color will turn darker than normal.
First I think there is something wrong with the scene but when I render the exact scene without any diffuse color or map in a different version of luxCore it became more clear.
Here is the rendered scene and screenshot of the scene that may help to investigate the problem.
it can be reproduced with any kind of bump/normal bump.
Screenshot 2021-01-12 122238.jpg
Bump-Color-Test-Issue-001.rar
(3.35 MiB) Downloaded 171 times
User avatar
TAO
Developer
Developer
Posts: 851
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by TAO »

Is anyone seeing the same issue and if it's the case is there any solution to it?
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by Dade »

TAO wrote: Sat Jan 16, 2021 8:54 pm Is anyone seeing the same issue and if it's the case is there any solution to it?
I noticed there is a difference if I render your scene with GPU or CPU but this may happen because of the texture node configuration. It doesn't very much make sense to me and I'm not sure what is supposed to be the output:

Code: Select all

scene.textures.Map_5.type = "imagemap"
scene.textures.Map_5.file = "imagemap-00001.jpg"
scene.textures.Map_5.gain = 1
scene.textures.Map_5.gamma = 1
scene.textures.Map_5.storage = "byte"
scene.textures.Map_5.mapping.type = "uvmapping2d"
scene.textures.Map_5.mapping.uvindex = 0
scene.textures.Map_5.mapping.rotation = 0
scene.textures.Map_5.mapping.uvscale = 1 1
scene.textures.Map_5.mapping.uvdelta = 0 0
scene.textures.Map_5.randomizedtiling.enable = 0
##
scene.textures.Map_3.type = "scale"
scene.textures.Map_3.texture1 = "Map_5"
scene.textures.Map_3.texture2 = "0.01"
##
scene.textures.Map_8.type = "imagemap"
scene.textures.Map_8.file = "imagemap-00003.jpg"
scene.textures.Map_8.gain = 1
scene.textures.Map_8.gamma = 1
scene.textures.Map_8.storage = "byte"
scene.textures.Map_8.mapping.type = "uvmapping2d"
scene.textures.Map_8.mapping.uvindex = 0
scene.textures.Map_8.mapping.rotation = 0
scene.textures.Map_8.mapping.uvscale = 1 1
scene.textures.Map_8.mapping.uvdelta = 0 0
scene.textures.Map_8.randomizedtiling.enable = 0
##
scene.textures.Map_7.type = "normalmap"
scene.textures.Map_7.texture = "Map_8"
scene.textures.Map_7.scale = 1
##
scene.textures.Map_6.type = "scale"
scene.textures.Map_6.texture1 = "Map_7"
scene.textures.Map_6.texture2 = "1"
##
scene.textures.Map_2.type = "add"
scene.textures.Map_2.texture1 = "Map_3"
scene.textures.Map_2.texture2 = "Map_6"
[...]
scene.materials.Material_25.bumptex = "Map_2"
You are mixing bump mapping and normal mapping (i.e. you can't) and do some math operation across them.

If you use only normal mapping:

Code: Select all

scene.materials.Material_25.bumptex = "Map_7"
It works as expected both on CPU and GPU.

If you use bump mapping alone (with an appropriate scale) it works as expected too:

Code: Select all

# instead of 0.01
scene.textures.Map_3.texture2 = "0.1"
[...]
scene.materials.Material_25.bumptex = "Map_3"
Support LuxCoreRender project with salts and bounties
User avatar
TAO
Developer
Developer
Posts: 851
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by TAO »

I check the other scenes too and even without textures that can happen too.
I posted the scene in a different thread but I will add it here too.
There are somethings not quite right with GPU render and it happens after v2.3. If I render the scene in luxCore 2.3 with the exact same node render will be perfect.

CPU vs GPU
file2.jpg
file.jpg
The issues thread viewtopic.php?f=4&t=3011
Last edited by TAO on Sun Jan 17, 2021 3:30 pm, edited 2 times in total.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by Dade »

See the answer in other thread (note: the two problems are not related).
Support LuxCoreRender project with salts and bounties
User avatar
TAO
Developer
Developer
Posts: 851
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by TAO »

Dade wrote: Sun Jan 17, 2021 3:25 pm See the answer in other thread (note: the two problems are not related).
Nice I will try that.
Other things, I created the node's base on B.Y.O.B. suggestions. this thread viewtopic.php?f=5&t=1010&start=160#p22516
are those the wrong parameters? or should I ever use standard bumps at all?
User avatar
TAO
Developer
Developer
Posts: 851
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by TAO »

Dade wrote: Sun Jan 17, 2021 3:14 pm
TAO wrote: Sat Jan 16, 2021 8:54 pm Is anyone seeing the same issue and if it's the case is there any solution to it?
I noticed there is a difference if I render your scene with GPU or CPU but this may happen because of the texture node configuration. It doesn't very much make sense to me and I'm not sure what is supposed to be the output:
I think I found the source of the issue finally, I noticed if I use any map on bump texture the color will affect diffuse color, this happening even with black and white images and just on GPU. The strange part is with any different GPU the result will be different!!!.

Finally, If I use a non-color data image everything will work perfectly.
The images below are the result of the exact same image and exact same nodes just when I used a non-color image and both render on GPU OpenCL.
none-color-space-bump.jpg
none-color-space-bump-2.jpg
none-color-space-bump-3.jpg
none-color-space-bump-3.jpg (62.2 KiB) Viewed 3809 times
I still can see that the round objects are a little bit darker but the bump result is perfect.
the question is why is that happen only on GPU and jot CPU?
Also, as many users use standard black and white jpg images for bump texture is there any good solution to avoid this behavior?
Last edited by TAO on Sat Jan 23, 2021 9:27 pm, edited 2 times in total.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by Dade »

TAO wrote: Sat Jan 23, 2021 12:13 pm Finally, If I use a non-color space image everything will work perfectly.
This image below is the result of the exact same image and exact same nodes just when I used a non-color image and both render on GPU OpenCL.
What is a "non-color image" ?
Support LuxCoreRender project with salts and bounties
User avatar
TAO
Developer
Developer
Posts: 851
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: Wrong Diffuse color with Bump in new luxCore 2.4 and up

Post by TAO »

Dade wrote: Sat Jan 23, 2021 4:40 pm
TAO wrote: Sat Jan 23, 2021 12:13 pm Finally, If I use a non-color space image everything will work perfectly.
This image below is the result of the exact same image and exact same nodes just when I used a non-color image and both render on GPU OpenCL.
What is a "non-color image" ?
I found this article that may help.

Choosing Color Data vs Non-Color Data determines whether or not Blender will color manage your image.
r07bs.jpg
Gamma Correction is a way of compressing color data and is commonly used in many image formats, such as PNG and JPEG. Without getting into the mathematical nitty-gritty, Gamma Correction raises the intensity of a pixel to a certain power (or gamma value) to encode it, then raises it to the reciprocal power to decode it. Why would we want to do this? Here's a helpful table from Wikipedia:
P3oQB.png
Source : https://en.wikipedia.org/wiki/Gamma_cor ... eo_display
The bottom row, Linear intensity represents the non-gamma corrected values. You will observe that there is a large jump in intensity between 0.0 and 0.1 stops. In the top row, Linear encoding (meaning it is gamma-corrected), you will see that the difference in intensity between the stops is much more even.

What this means is that a basic linear scale does not equally distribute intensity as our eyes see it across the range [0, 1]. Referencing back to our image, between stops 0.0 and 0.1 on the bottom row, that whole range of color has to be squeezed into one tenth of the available range. On the other end of the spectrum, the range between 0.8 and 1.0 on the bottom only needs 0.9 to 1.0 on the top. This way, the colors that we can see are given more "space", and the colors we can't really distinguish from one another receive less.

Most common image formats (and video displays) use sRGB (standard Red Green Blue) as their chosen encoding. This actually has a non-linear gamma (don't worry about it) that can be approximated by 2.2.

When you select Color Data, Blender will gamma correct your image (based on the image encoding). When you select Non-Color Data, Blender will not alter the RGB values of the image, leaving them in a linear scale.
https://en.wikipedia.org/wiki/SRGB

Color Data should be used for image textures being used to color a model, like Diffuse and Albedo textures. This way, they will be color managed to display their intended color values.

Non-Color Data should be used for image textures being used to store other data. For example, Normal Maps store the normal vector data of a given point on a mesh. Vectors (in this case) are linear and have no need to be gamma corrected. The same goes for other maps like Bump maps or Specular maps. These images had values stored to them on a linear scale, so they should be read on a linear scale.

Hope that all made sense. I'm happy to clarify anything.
P14SC.png
Left - Color Data:

How the image is intended to look.

Center - Non-Color Data:

The image with no gamma correction. Note how there are lots of lighter values and very few dark values, making it look "washed-out."

Right - Non-Color Data with Gamma node:

This looks very similar to the Color Data image. It isn't exactly identical, though, since the image was encoded with sRGB, while decoded with a normal Gamma of 2.2.
Post Reply