Forum: Freestuff


Subject: Simple Dual Material Shader for DAZ Studio [Beta]

3dcheapskate opened this issue on Oct 08, 2012 · 4 posts


3dcheapskate posted Mon, 08 October 2012 at 12:38 AM

In Renderosity Freestuff [ here](http://www.renderosity.com/mod/freestuff/details.php?item_id=69607)- still in beta, but it works in DS3 Free, DS3 Advanced, and DS4 Pro (and probablyy DS4 Free if anybody has that). Check the readme for more info. Feel free to play around with the shader network if you use Shader Mixer - use it, modify it, dump it, whatever.

Most things work, except refraction and normal maps (see readme).

This is basically for situations where you have a single surface but want to use two separate materials (e.g. a shiny reflective gold paint design on a stone surface). Yes, you can already do this by creating separate images to plug into the diffuse, bump, and specular channels (and that’s not uncommon). But when you have two REALLY different materials that require separate values for glossiness, specular strength, reflection strength, etc, as well…

Seemed to me that specifying the two materials separately, and using a simple greyscale image to define which material is used where, was a simple solution. You can already do this in Poser’s Material Room (since Poser 6 at least), and now DAZ Studio has Shader Mixer, which can do this too. But many people don’t use Shader Mixer. So I’ve created a simple (but quite big!) shader network, and made all the important stuff accessible from the normal Surfaces tab.

Attached image shows the shader out-of-the-box applied to a sphere primitive. Not too impressive, eh? Just a very simplistic goldleaf on smooth stone effect - the only differences between the Base Texture and Overlay Texture are diffuse/specular colours, glossiness, and specular strength.


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



3dcheapskate posted Mon, 08 October 2012 at 12:43 AM

Make the following changes and you get the image above (I added a red torus primitive to check the reflections were working):

Base Texture: Add an image (Clouds.png*) to the Base Texture’s diffuse color, specular color and displacement

Overlay Texture: Add tiling (3 tiles each way), ray-traced reflection, and a bump image (Noise.png*).

 

*Images in the same folder as the DBM, DUF, and DSA files - see readme.


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



3dcheapskate posted Mon, 08 October 2012 at 12:48 AM

After a bit of fiddling I got refraction to work with the existing network. You need to change two parameters in the 'Reflect And Refract' brick for the Base Texture or Overlay Texture, whichever you're using (you can only do this in Shader Mixer - I hid the parameters from the Surfaces tab on this beta, sorry!):
-Sample cone: Set this to 0, not 1
-Max distance: Start with it set at 1. If the refraction doesn’t work try 10, then 100, then 1000, etc.

I'm still working on the normals...

Also, while playing with the shader on the Surfaces tab, I realised that some way to invert and/or change brightness/contrast of the Overlay Mask image would be useful, and quite easy to implement. Working on this too.

Any other ideas?


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



3dcheapskate posted Tue, 06 November 2012 at 12:49 AM

Thanks to millighost I now know why my normals aren't working: the outputs of a Normal Map brick are the normals in camera-space after being applied to the object. I was incorrectly assuming that they were still in tangent-space. This makes the maths a bit more awkward, but at least I'm now on the right track with the normals!

 

A few further thoughts

================

Overlay Mask: Two sliders seem a good idea to make any mask image more flexible. Contrast + Brightness perhaps? Or Black Level and White Level?

Reflection: Perhaps only one Environment Colour Map/Trace/Mix brick network should be used? The base and overlay will be reflecting exactly the same thing, and it's only the reflection strength that is likely to differ.

Opacity: The overlay mask itself is the opacity of the overlay!

Refraction: Since the overlay is assumed to be a thin layer applied on top  the base, the effect of overlay refraction depends on overlay thickness, which does not exist (except perhaps if we use bump/displacement). Could add a 0-100% slider to let the user set the value?

You know those kid's balloon with coloured designs on them? And when you look through the balloon at the back of the design it's just a flat opaque colour? Can't see a way to do that.

 

Other reminders to self:

=================

I noticed when I was doing my tileable mail textures that normal maps didn't tile in DS3. They can easily be made to tile correctly using Shader Mixer.

If you combine two tileable Image Map bricks with a Mix brick, but set different tiling values (prime numbers) then the pattern repeat is increased to the product of the two numbers. Might be useful for large plain surfaces?


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).