An assortment of OSL shaders for your perusal

Hi everybody!

I have some OSL shaders lined up for you which I’ll post here one by one as soon as the page for the shader is done.

To kick this off I present to you…
The Reflector!

Links
Page:

Download:
http://www.rensheeren.com/osl/reflector\_tex\_v002.osl
http://www.rensheeren.com/osl/rhfunctions.h
Save both in the same folder, both are needed for the shader to work. Overwrite rhfunctions.h if asked.

Features
- Metals and non-metals. Uses complex Fresnel for metals and switches to non-complex for non-metals for quicker rendering.
- Polarisation for both, should you want to play around with that.
- Outside medium IOR, for example for objects under water.
- Aaaand… rough Fresnel!

------ EDIT ------

I’ve moved this post here!

Here’s a list of all the shaders posted in this thread instead. :slight_smile:

Overview page on my site here.

Reflector
Advanced reflections.

ShowUDIM
Shows where you are in UV/UDIM space! In text!

Merge2
Merge or blend two inputs using several different operations.

CamMapScale
A fix for the annoying CamMapPerPixel scaling feature in max.

MixNormalMaps
Blend normal maps together… correctly.

ChannelSwitcher
Shuffle or mix channels.

UVTransform
Transform textures by moving the UV space around.

ArchGlass
Simulate multi-paned window glass with only a single-sided plane object.





That does look nice. I wonder why vray mtl does not have this by default?

Because there are only 24 hours in a day? Because we have also 100 other things to do? Like a denoiser, to take an example at random… Or ftupid Maya 2016.5 stuff… Will get to it, but in the meantime, this is exactly why you have OSL.

Keep in mind that implementing glossy Fresnel properly is not possible with OSL, it must be done in the BRDF implementation itself. You can only get an approximation with OSL.

Best regards,
Vlado

Great work Rens, stuck in Clarisse land at the minute but gonna have a dig through this in July - osl seems really useful. Also just finished some film shots with Jan Volckmann - he’s great fun to be around and does really subtle comp work.

Very cool Rens.
I’m using your mixNormalMaps map allmost every day. You really deserve your entry;)
Looking forward to try this one and see your library grow.

Thanks!

True! It’s just a blend between the front facing (0 deg) reflection amount and the Fresnel curve, but it holds up surprisingly well.

Hey John! How are things? This should work in Clarisse. Oh nice haha, say hi from me. : )

Hehe thanks, glad to be in there. : )
Oh yeah that reminds me, I’ll post that one here as well.

And the second one!

ShowUDIM
For displaying the current UDIM tile number, very handy when working with UDIMs!

Links
Page:

Download links:
http://www.rensheeren.com/osl/showUDIM\_tex\_v001.osl
http://www.rensheeren.com/osl/rhfunctions.h
Save both in the same folder (right click, save as), both are needed for the shader to work. Overwrite rhfunctions.h if asked.

Features
- Displays the UDIM tile number as text or as a colour value.

How to use
– Create a VRay OSL Texture map.
– Load in the downloaded .osl shader.
– Create a VRayLightMtl.
– Plug the OSL map into the color.
– Disable ‘wrap texture coordinates’ in the OSL tex!




That’s very cool :slight_smile:

Best regards,
Vlado

Well we have OSL. So we do have it. You can’t implement all the things into the VRayMtl. I mean sure it would make sense but as I see it it is not a high priority issue since we are able to achieve it with OSL to a certain extend.

Both very cool Rens!

Hi Rens,

Are these VRay OSL Texture maps compatible with Maya?

yes they should be compatible :slight_smile: I haven’t checked these, but the iridescence.osl worked.

Sweet…thanks Dmitry.

Thanks! With this it shouldn’t be hard to make some 8-bit adventure game in activeshade mode. No need for a boss key hehehe : )

Thanks! I have a couple more ready to go in the next few days!

I haven’t tested it yet, but if thin film works in Maya as Dmitry said then this should hopefully work as well. Texture/colour inputs are different in Max and other applications. The reflector shader just checks to see if VRay is used and then switches the input type, so if it works in Maya with VRay it should work everywhere. : )

And the third!

Merge2
Merge two inputs using Nuke-style operations.

Links
Page:

Download link:
http://www.rensheeren.com/osl/merge2\_tex\_v001.osl

Features
- Merge two inputs.
- Takes alpha channels into account.

How to use
– Create a VRay OSL Texture map.
– Load in the downloaded .osl shader.
– Connect the inputs to merge.
– Set the mode.



I think you’ll like this one. :slight_smile:

CamMapScale
Scales an image to the original image ratio when using Camera Map Per Pixel, instead of the annoying ‘feature’ where it scales the image to the render output size.
So if you have a square image, you can project a square image!

Links
Page:

Download link:
http://www.rensheeren.com/osl/camMapScale\_tex\_v001.osl

Features
– Scales the input image back to its original aspect ratio when using Camera Map Per Pixel.

How to use
– Create a VRay OSL Texture map.
– Load in the download OSL shader.
– Plug in the map and set your render and map resolution. The shader will scale the image back to the map resolution.
– Make sure ‘wrap texture coordinates’ (General tab) is disabled in the OSL shader!



This is great Rens! So glad I found it this thread!

Vlado, would it be possible to make a forum board for OSL? Typing “OSL” in the search results in “Sorry - no matches. Please try some different terms.” It would be awesome to have a central place where we can all share this OSL goodness (and a place where we could find it too!). I’d suggest that the OSL board be for all applications, not just Max or Maya.

Has this been posted yet? Maybe I missed it…

@sharktacos
You can find it here:
http://forums.chaosgroup.com/showthread.php?86115-Mixing-Normal-Maps&highlight=mixing+normal+maps

@Rens:
Cool stuff, keep it up. :smile: