LuxCore: new material transparency property

Discussion related to the implementation of new features & algorithms to the Core Engine.

Moderators: Dade, jromang, tomb, zcott, coordinators

LuxCore: new material transparency property

Postby Dade » Fri Jan 01, 2016 8:08 am

Introduction

After nearly 10 years was about time to put the MIX+NULL material trick at rest. All LuxCore materials now support a new attribute: transparency.

New material transparency attribute

It is probably more a "solidity" attribute than a "transparency " but, anyway, with the following syntax:

Code: Select all
scene.textures.tex.type = checkerboard2d
scene.textures.tex.texture1 = 0.0
scene.textures.tex.texture2 = 1.0
scene.textures.tex.mapping.uvscale = 32 -32
##
scene.materials.shell.type = matte
scene.materials.shell.kd = 0.7 0.0 0.0
scene.materials.shell.transparency = tex


You can now obtain what it was done with MIX+NULL before:

check.jpg


Indeed, the default .transparency value is 0.0 (i.e. 100% solid).

NULL material

NULL material is a bit a special case. First of all, the default value is 1.0 (i.e. 0% solid). Second you may want to use colors instead of single channel/float textures as it can be used to build plain transparencies, for instance with:

Code: Select all
scene.textures.tex.type = checkerboard2d
scene.textures.tex.texture1 = 0.75 0.25 0.25
scene.textures.tex.texture2 = 0.75 0.75 0.75
scene.textures.tex.mapping.uvscale = 32 -32
##
scene.materials.shell.type = null
scene.materials.shell.transparency = tex


To obtain:

null.jpg


All paths always go trough the material but they are blended with the .transparency color. It is a like an poor-man, cheap to render, glass without refraction or reflection.

ARCHGLASS material

ARCHGLASS is another special case where the defined .transparency is always ignored in order to work as ARCHGLASS has always worked.

MIX material

MIX material .transparency is used if defined otherwise the .transparency of child nodes is mixed as expected. This works like .emission.

Performance

Indeed, rendering a material defined with .transparency is a lot faster than the same result obtained with MIX+NULL and it doesn't require OpenCL kernel recompilation.
User avatar
Dade
Developer
 
Posts: 8357
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Re: LuxCore: new material transparency property

Postby pciccone » Fri Jan 01, 2016 12:37 pm

Excellent! Thank you very much Dade and Happy New Year.
User avatar
pciccone
Developer
 
Posts: 1579
Joined: Wed Jan 13, 2010 11:02 am
Location: South Carolina

Re: LuxCore: new material transparency property

Postby bertrand » Fri Jan 01, 2016 2:16 pm

Happy new year Dade :)

Nice work. Will certainly try to test it in the coming days if a buildbot comes.
bertrand
 
Posts: 160
Joined: Wed Mar 04, 2015 12:55 pm

Re: LuxCore: new material transparency property

Postby B.Y.O.B. » Sun Jan 03, 2016 3:20 pm

Indeed, rendering a material defined with .transparency is a lot faster than the same result obtained with MIX+NULL and it doesn't require OpenCL kernel recompilation.

Great!
Guess the LuxBlend nodes need a new socket... have to think about the best way to add this.
For the classic editor it should be fairly easy, we can just use the already existing "alpha transparency" panel.
User avatar
B.Y.O.B.
Developer
 
Posts: 5136
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Re: LuxCore: new material transparency property

Postby B.Y.O.B. » Sun Jan 03, 2016 8:08 pm

While reading the latest luxrays commits I found this:

https://bitbucket.org/luxrender/luxrays ... al.cpp-163
Code: Select all
void Material::UpdateTextureReferences(const Texture *oldTex, const Texture *newTex) {
   if (transparencyTex)
      transparencyTex = newTex;
   if (emittedTex == oldTex)
      emittedTex = newTex;
   if (bumpTex == oldTex)
      bumpTex = newTex;
}

Shouldn't the first if look like this? (check for == oldTex)
Code: Select all
if (transparencyTex == oldTex)
      transparencyTex = newTex;
User avatar
B.Y.O.B.
Developer
 
Posts: 5136
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Re: LuxCore: new material transparency property

Postby jensverwiebe » Mon Jan 04, 2016 3:05 am

B.Y.O.B. wrote:While reading the latest luxrays commits I found this:

https://bitbucket.org/luxrender/luxrays ... al.cpp-163
........


Indeed, copy pasta issue :D

I fixed it

Jens
User avatar
jensverwiebe
Developer
 
Posts: 3407
Joined: Wed Apr 02, 2008 4:34 pm

Re: LuxCore: new material transparency property

Postby B.Y.O.B. » Mon Jan 18, 2016 7:05 am

LuxBlend now uses this feature in its "LuxRender Alpha Transparency" settings.
I have yet to implement this for nodes.
User avatar
B.Y.O.B.
Developer
 
Posts: 5136
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Re: LuxCore: new material transparency property

Postby B.Y.O.B. » Sat Jan 23, 2016 11:09 am

When I set transparency to 0.0 the object becomes fully opaque.
Does this make sense/is intended?
If so, what is the recommended min value for transparency?

edit: another strange bug:
mix mat set to transparency 1 (notice the red material set to transparency 0.1):

strange.PNG

and mix mat set to transparency 0:

strange2.PNG

Number 2 seems the right behaviour to me, but why is that only possible with mix tranps = 0?

Blender and LuxCoreUI scene attached.
Attachments
output.zip
(29.65 KiB) Downloaded 57 times
strange.blend
(154.89 KiB) Downloaded 64 times
User avatar
B.Y.O.B.
Developer
 
Posts: 5136
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Re: LuxCore: new material transparency property

Postby jensverwiebe » Sat Jan 23, 2016 3:02 pm

B.Y.O.B. wrote:When I set transparency to 0.0 the object becomes fully opaque.
Does this make sense/is intended?
If so, what is the recommended min value for transparency?


Simon, i found the reason for 0.0 opacity, lets talk in IRC later.
So far its a export bug in conjunction with a tansparency core default = 1.

I fixed it.

Looking into issue 2) asap. It is a consequency of 1)

EDIT: i should have fixed all mixmat case too.https://bitbucket.org/luxrender/luxblen ... 9d9847f9c5



Jens
User avatar
jensverwiebe
Developer
 
Posts: 3407
Joined: Wed Apr 02, 2008 4:34 pm

Re: LuxCore: new material transparency property

Postby B.Y.O.B. » Sat Jan 23, 2016 6:48 pm

Great, thanks for fixing :)
User avatar
B.Y.O.B.
Developer
 
Posts: 5136
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Next

Return to Architecture & Design

Who is online

Users browsing this forum: No registered users and 2 guests