Jump to content

Surface Uber Shader


slayerk

Recommended Posts

Im just end to write main part of my own surface shader.

package contains compile.sh - linux bash script for compiling this shader into *.otl-file, source code for this shader and 2 *.otl-files for Houdini 11.1 and Houdini 12.0.

compile.sh

Need to correct Line:

H_INSTALL=~/tools/bin

to correct Houdini Install dir (Folder which contains a set of "hfs<VERSION>" folders).

also need to correct lines:

compile "11.1.118"
compile "12.0.526"

to compile shader with you installed versions of Houdini.

Very Welcome to comments on code and possible mistakes.

A test turntable and some of export passes (without any compositing):

1m 10s - 1m 20s per frame on Phenom X6 1100T RAM 8Gb 1333MHz. image res: 1200x804.

post-3849-132836537315_thumb.jpg

shader.tar.gz

post-3849-132844374919_thumb.jpg

post-3849-132844375817_thumb.jpg

post-3849-132844381418_thumb.jpg

post-3849-132844382111_thumb.jpg

Edited by slayerk
Link to comment
Share on other sites

how fun is this?!

i've been exploring your shader a bit.

i really like having an occlusion tab. i've never really seen anything like it.

also, on the reflection tab i'm really loving the fresnel fade. another shader control i haven't had much experience with. thanks for the ETA variable as well. this will help to match real world materials.

.... now i am going to play a bit more.

Link to comment
Share on other sites

Very nice, thank you! I like controls for optional masking.

There is a question about occlusion pass though. You seem to be adding it to Cf, which doesn't always play nicely with rest of material's components.

Basically, if an occlusion meant to be environment light, that's fine (though begs for a question why this light obey self occluding, unlike direct component).

On the other hand, if an occlusion doesn't have environment map applied, it's more like a map to be used as a modulator for most other components (including reflections with different cone angle for occlusion rays). If you simply add it to Cf, your object gets magically brighter than supposed to be.

That's why there is a second occlusion() method, which gives you separated shadowing and bend normals to lookup environment map. This way you can add lighting from the environment, leaving the occlusion float as a multiplier for this and other components.

Also, it would be cool to provide your shader as a VOP node.

cheers!

skk.

Link to comment
Share on other sites

Very nice, thank you! I like controls for optional masking.

There is a question about occlusion pass though. You seem to be adding it to Cf, which doesn't always play nicely with rest of material's components.

Basically, if an occlusion meant to be environment light, that's fine (though begs for a question why this light obey self occluding, unlike direct component).

On the other hand, if an occlusion doesn't have environment map applied, it's more like a map to be used as a modulator for most other components (including reflections with different cone angle for occlusion rays). If you simply add it to Cf, your object gets magically brighter than supposed to be.

That's why there is a second occlusion() method, which gives you separated shadowing and bend normals to lookup environment map. This way you can add lighting from the environment, leaving the occlusion float as a multiplier for this and other components.

Also, it would be cool to provide your shader as a VOP node.

cheers!

skk.

I never use occlusion as multiplyer when i render cg objects. When I insert rendered objects in real shot i render a shadow and occlusion pass for multiplying on real shot image.

for example:

cg car going on real road. Camera tracking, rough road geometry and environment.

cg car cast occlusion and shadows on road. in this case i render occlusion and multiply on shot image to simulate environment shadow from car on the road. cg car rendered with a road (and rough environment if it is) marked as "Phantom Object" for reflections and occlusion.

I especially include a source code for you freedom. And tried to make it clear and understandable. If you frequently use occlusion as multiplyer you can make it!

I'm planned to add a gather occlusion (now occlusion calculates with occlusion() function) - it gives me not only occlusion but a GI.

and also irradiance which calculates with irradiance() function.

occlusion() and irradiance() - more specific and narrow function in compare with gather, but he is faster.

Also, it would be cool to provide your shader as a VOP node.

Good idea like a co-shader! but i represent how much inputs he would be have. a vop node with vertical length -> ∞.

also shader have a lot of export variables:

export 	vector 	exportRawConstant=0;
export 	vector 	exportConstantIntensity=1;
export 	vector 	exportConstant=0;
export 	vector 	exportRawDiffuse=0;
export 	vector 	exportDiffuseIntensity=1;
export 	vector 	exportDiffuse=0;
export 	vector 	exportRawSpec01=0;
export 	vector 	exportSpec01Intensity=1;
export 	vector 	exportSpec01=0;
export 	vector 	exportRawSpec02=0;
export 	vector 	exportSpec02Intensity=1;
export 	vector 	exportSpec02=0;
export 	vector 	exportRawSpec03=0;
export 	vector 	exportSpec03Intensity=1;
export 	vector 	exportSpec03=0;
export	vector	exportRawOccl=0;
export	vector	exportOcclIntensity=1;
export	vector	exportOccl=0;
export	vector	exportEnv=0;
export	vector	exportRawReflect=0;
export	vector	exportReflectIntensity=1;
export	vector	exportReflect=0;
export	vector	exportRawRefract=0;
export	vector	exportRefractIntensity=1;
export	vector	exportRefract=0;
export	vector	exportSSS=0;

export	vector	exportMask01=0;
export	vector	exportMask02=0;
export	vector	exportMask03=0;
export	vector	exportMask04=0;
export	vector	exportMask05=0;

and each gather loop has his own export variables:

export vector 	export##prefix##GatherReflComp=0; \  \\ - integrate only rays who hit any surface
export vector 	export##prefix##GatherEnvComp=0; \   \\ - integrate only rays who hit environment
export float 	export##prefix##GatherOcclComp=0     \\ - black/white image represents a reflection occlusion

for reflect prefix is "reflect" ans names would be:

export vector 	exportreflectGatherReflComp=0; \
export vector 	exportreflectGatherEnvComp=0; \
export float 	exportreflectGatherOcclComp=0

analogically for refract.

Edited by slayerk
Link to comment
Share on other sites

I never use occlusion as multiplyer when i render cg objects.

This doesn't work with mixed lighting, when you want occlusion effect for self shadowing, but not environmental light, since light comes from different sources. It could be an option in Occlusion Tab (mult or add). Surely people could mess with the code, but seriously anyone who can do it, can do his own shader anyway :).

Nice renders!

cheers,

skk.

Link to comment
Share on other sites

This doesn't work with mixed lighting, when you want occlusion effect for self shadowing, but not environmental light, since light comes from different sources. It could be an option in Occlusion Tab (mult or add). Surely people could mess with the code, but seriously anyone who can do it, can do his own shader anyway :).

Nice renders!

cheers,

skk.

myltiply by occlusion and fake caustics added.

shader.tar.gz

Link to comment
Share on other sites

  • 4 months later...

29.06.2012

Version 0.6

Added "Screen Space" in UV Layer Menu to Project Textures On Geometry via Shader

Added Texture Filtering Method Menu Choice

Edit "Fake Caustics" Shadow Calculation. Now respect refract Refract Intensity and Intensity Map Luminance

shader.tar.gz

Edited by slayerk
Link to comment
Share on other sites

  • 1 month later...

Update:

// Version 0.61

// Added Possibility to use baked texture to Difuse And Occlusion (Non View Dependent components)

// Version 0.62

// Added option to not calculate occlusion if ray level>0. See Occlusion Tab. Usful for Some Situations.

// Version 0.63

// Added Color Correction SubTab on reflection Tab. Usful for emitating metal's colored reflections.

shader.rar

post-3849-134591969489_thumb.jpg

untitled.hip

Edited by slayerk
Link to comment
Share on other sites

Update:

// Version 0.61

// Added Possibility to use baked texture to Difuse And Occlusion (Non View Dependent components)

// Version 0.62

// Added option to not calculate occlusion if ray level>0. See Occlusion Tab. Usful for Some Situations.

// Version 0.63

// Added Color Correction SubTab on reflection Tab. Usful for emitating metal's colored reflections.

awesome shader!

thanks.

is it possible to create color-bleeded ambient occlusion like mentalray's architecturial shader?

like on the pic

http://imagic.ddgenvivo.tv/forums/newsgambocc/poc1a.jpg

Link to comment
Share on other sites

  • 2 weeks later...

// Version 0.64

// Added Irradiance.

// Added "Occlusion Tint" Parameter in Occlusion Tab

// Added "Options" for controlling Special Parameter "Use Emission".

// Emission Used for calculation irradiance. if globalraylevel()>0 and "Use Emission" enabled, then diffuse and occlusion doesn't calculates,

// emission color is used instead. It's usful for increase "color bleeding effect". because

// real irradiance gives almost invisible result, especially on small number of GI bounces.

// Use it with 1 GI bounce for fast fake GI.

// Typical behavior is to use the same "Tint Color" for "Diffuse/Diffuse Color", "Occlusion/Occlusion Tint",

// "Irradiance/Irradiance Tint" and "Options/Emission Color" theese are all diffuse-based components.

// "Use Emission" is a fast way to fake GI and colorize dark areas. "Emission Color" is a measure of "Bleeding Effect".

// You also may to calcula real Gi by Disabling "Use Emission".

//

// Version 0.65

// Added ColorCorrection Parameters to Speculars. Usful for emitating metal's colored speculars with colored Light Emitters.

new export variables:

vector exportRawIrrad
vector exportIrradIntensity
vector exportIrrad

post-3849-134693703555_thumb.jpg

post-3849-134693704098_thumb.jpg

test_my_shader.hip

post-3849-134694974365_thumb.jpg

shader.rar

Edited by slayerk
Link to comment
Share on other sites

  • 1 month later...

I'm trying to experiment with this. I've pulled it down from Orbolt, but when I try and use it I get this error

mantra: VEX error: Unable to load opdef:/_slayerk::Shop/my_shader_v01 Path not found

This is in Houdini FX 12.1.69 HD Non Commercial, Windows 7 64 bit

Link to comment
Share on other sites

OK, I downloaded the latest and got it to work. Looks good so far. However, does it support PBR? WHen I render a simple cube, it just shows black. When I switch back to raytrace or Micropoly then it works.

Also, thnkas for posting this! It's got a ton of options I'm very curious to fiddle with.

Edited by jim c
Link to comment
Share on other sites

OK, I downloaded the latest and got it to work. Looks good so far. However, does it support PBR? WHen I render a simple cube, it just shows black. When I switch back to raytrace or Micropoly then it works.

Also, thnkas for posting this! It's got a ton of options I'm very curious to fiddle with.

Not I'm never use PBR because don't like to wait. My typical limit to production frame is 20 min/frame for 2k (this is PRODUCTION limit. when I setting up the scene I, obliviously, want to work more interactively). if rendertime is more than this limit I need to optimize something or make more compositing work. maybe turn off something and etc. This is the reason why i always use micropoly. Only micropoly. I also never using a raytrace engine.

this shader is distributed with source code if you have a desire to implement it for PBR - lets go!

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...