Add shader

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.
Rob van Berkel
Posts: 5
Joined: Tue May 08, 2018 6:00 am

Add shader

Post by Rob van Berkel »

Switching from Cycles to Lux, and playing with nodes in my materials. There I noticed there is no "add shader" as blender and cycles have, just a mix shader.
This makes it impossible to split my transparent material in 3 colors (with each a different roughness) which then get added, I can only mix them with the "mix materials", thus averaging the 3 components which leaves me with a dull and dark render.
Is there any way around this to add various shader components? Or are there plans to implement a add-shader?

cheers,
Rob
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Add shader

Post by Dade »

Rob van Berkel wrote: Tue May 08, 2018 6:16 am Switching from Cycles to Lux, and playing with nodes in my materials. There I noticed there is no "add shader" as blender and cycles have, just a mix shader.
This makes it impossible to split my transparent material in 3 colors (with each a different roughness) which then get added, I can only mix them with the "mix materials", thus averaging the 3 components which leaves me with a dull and dark render.
Is there any way around this to add various shader components? Or are there plans to implement a add-shader?
It is the first time someone ask for this feature, probably because there is an "add" texture. However, it can not fix your problem if you need a color dependent roughness.
At the moment, I can not think to a work around, you could try to post an image of the material you are trying to render to see if someone can find a workaround. I'm not aware of a material having a light wavelength dependent roughness :?:
Support LuxCoreRender project with salts and bounties
FiatLux
Posts: 21
Joined: Sat Apr 21, 2018 8:41 pm

Re: Add shader

Post by FiatLux »

Are you by any chance tryin to emulate the cycles' trick to fake dispersion?
Rob van Berkel
Posts: 5
Joined: Tue May 08, 2018 6:00 am

Re: Add shader

Post by Rob van Berkel »

Dade wrote: Tue May 08, 2018 6:54 am
It is the first time someone ask for this feature, probably because there is an "add" texture. However, it can not fix your problem if you need a color dependent roughness.
At the moment, I can not think to a work around, you could try to post an image of the material you are trying to render to see if someone can find a workaround. I'm not aware of a material having a light wavelength dependent roughness :?:
Agree, there is no such thing as light dependent roughness. Or is there? Let me explain a bit what I try to accomplish:
I'm a photographer (models, artistic) and sometimes I use a bit of vaseline on the lens (well on the UV filter actually) to get a blur. This vaseline has a scattering effect, which is more or less wavelength dependent. Blue colors get scattered more. That's why you get this blueish blur in the image (along with quite stong dispersion of the light).
To mimic this effect in post processing of my photowork I use Blender (I use it for a lot more than this, of course). I load the original image on a plane as an emitting texture, put a cam in the scene pointing at the image and put some light modifying material in between.
To mimic the color-depentent scattering of light I would like to split the light in R, G and B by having 3 parallel glass-material shaders, each with its own roughness and own transmission color (R G and B). Then sum the 3 material-outputs to get the whole image together.
Finally I would add some dispersion effects, which are the main reason to move to Lux. And example of dispersion and some blur is attached. I just need more control over the scattering that gives these typical pastel blurs over the image.

So there's the reason me wanting to add materials.
Before I plunge in the code, I would try to find a solution that is a bit less cumbersome ;)
Attachments
example of the effect
example of the effect
Rob van Berkel
Posts: 5
Joined: Tue May 08, 2018 6:00 am

Re: Add shader

Post by Rob van Berkel »

FiatLux wrote: Tue May 08, 2018 8:32 am Are you by any chance tryin to emulate the cycles' trick to fake dispersion?
Nope, for that part I switched to Lux ;)
Rob van Berkel
Posts: 5
Joined: Tue May 08, 2018 6:00 am

Re: Add shader

Post by Rob van Berkel »

addition: I could render R G and B effects separately, resulting in 3 images which I then stack and add in photoshop but that is not workable - getting a preview of the effect needs to many actions in postprocessing.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Add shader

Post by Dade »

Rob van Berkel wrote: Tue May 08, 2018 9:10 am Agree, there is no such thing as light dependent roughness. Or is there? Let me explain a bit what I try to accomplish:
I'm a photographer (models, artistic) and sometimes I use a bit of vaseline on the lens (well on the UV filter actually) to get a blur. This vaseline has a scattering effect, which is more or less wavelength dependent. Blue colors get scattered more. That's why you get this blueish blur in the image (along with quite stong dispersion of the light).
To mimic this effect in post processing of my photowork I use Blender (I use it for a lot more than this, of course). I load the original image on a plane as an emitting texture, put a cam in the scene pointing at the image and put some light modifying material in between.
To mimic the color-depentent scattering of light I would like to split the light in R, G and B by having 3 parallel glass-material shaders, each with its own roughness and own transmission color (R G and B). Then sum the 3 material-outputs to get the whole image together.
Finally I would add some dispersion effects, which are the main reason to move to Lux. And example of dispersion and some blur is attached. I just need more control over the scattering that gives these typical pastel blurs over the image.
You could try to place a glass box (with dispersion enabled) between the picture and the camera. The box should have an inner homogenous volume with scattering enabled.

By playing with volume scattering factor, absorption and glass dispersion, you may able to achieve the result you are looking for. However, it hard to tell, you are going to need a LOT of tests.
Support LuxCoreRender project with salts and bounties
FiatLux
Posts: 21
Joined: Sat Apr 21, 2018 8:41 pm

Re: Add shader

Post by FiatLux »

I've not tested it, just an idea and I'm not 100% sure if I've understood, so sorry if I'll say nonsense,
what about 3 parallel glasses each one with their own material instead of a glass with 3 parallel materials?
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Add shader

Post by Dade »

FiatLux wrote: Tue May 08, 2018 9:37 am I've not tested it, just an idea and I'm not 100% sure if I've understood, so sorry if I'll say nonsense,
what about 3 parallel glasses each one with their own material instead of a glass with 3 parallel materials?
I was suggesting a single glass with a single material :?:
Support LuxCoreRender project with salts and bounties
FiatLux
Posts: 21
Joined: Sat Apr 21, 2018 8:41 pm

Re: Add shader

Post by FiatLux »

Dade wrote: Tue May 08, 2018 10:06 am I was suggesting a single glass with a single material :?:
I haven't see your reply. I started writing to OP then I left open the editor cause I had something to do, and posted later after your reply. :D

Anyway I've quickly tried mine and turned out everything black. So probably it's not a solution.
As for Add shader, it's not physically correct, it could make an object to release more light than received so I won't be so sure you'll get it in Lux.
Post Reply