Digital Art Zone

 
   
1 of 2
1
Simple Dual Material Shader (DS3Free to DS4Pro) [Beta]
Posted: 03 October 2012 01:45 AM   [ Ignore ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

Simple Dual Material Shader [beta version] uploaded to ShareCG and Renderosity Freestuff

(N.B. This was a prototype shader for a shield I was working on. Improved versions of the generic shader, “DMS(Full)” and “TMS(Full)” iirc, were included in the final DAZ Studio Shader For S.E. Asian Shields )

Works in DS3 Free, DS3 Advanced, and DS4 Pro. Don’t forget it’s still in beta though!
Check the readme for more info, and this DAZ Studio Discussion thread for more background (and hopefully further progress!)
Feel free to play around with the shader network if you use Shader Mixer - use it, modify it, dump it, whatever.

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 (using a simple greyscale image to define which 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. 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.

Most things seem to work - normal maps and refraction are the areas that still need sorting out.

Image Attachments
SDMS(Beta)Promo.png
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 06 October 2012 04:08 AM   [ Ignore ]   [ # 1 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

A couple more notes:

1) Refraction is okay with the existing network if you change two parameters in each of the two Reflect And Refract bricks (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.
Clearly I’ll need to put these parameters on the Surfaces tab.

2) The render on the promo isn’t straight out-of-the-box: the attached image shows what to expect if you simply create a sphere primitive and apply the shader to it. For the promo render I added an image (Clouds.png*) to the Base Texture’s diffuse color, specular color and displacement, and added tiling (3 tiles each way), ray-traced reflection, and a bump image (Noise.png*) to the Overlay Texture.

3) I’m still trying to get the normals working.

4) Playing around with the shader I realised that some easy way of inverting and/or changing the brightness/contrast of the Overlay Mask image would be rather useful. Any other suggestions while I’m going through this enthusiastic phase?

*Images are in the same folder as the DBM, DUF and DSA files.

Image Attachments
OutOfTheBox.png
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 17 October 2012 05:02 PM   [ Ignore ]   [ # 2 ]
Member
Avatar
Rank
Total Posts:  173
Joined  2005-07-28

This has the potential to be very useful.  Thanks!

 Signature 

My DAZ Gallery
My DeviantArt page
My Freebies: 3D Stuff - PSP Stuff

Profile
 
 
Posted: 31 December 2014 03:31 AM   [ Ignore ]   [ # 3 ]
Active Member
RankRank
Total Posts:  491
Joined  2005-11-06

Hi, this is a great shader. I’d like to know how to a separate separate reflection colours for the base and top layers, rather than for the whole surface. So far I’ve not had any luck. Can anyone point me in the right direction please?

 Signature 

BEGINNERS TUTORIALS FOR BRYCE
MY DAZ 3d STORE  for Bryce & DAZ Studio Materials and Shaders
BRYCE ARENA News and resources for Bryce

Profile
 
 
Posted: 31 December 2014 07:40 AM   [ Ignore ]   [ # 4 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

Hello again - check out the third image (the one that’s mostly dark grey) on the “DAZ Studio Shader For S.E.Asian Shields” page at ShareCG. The “DMS (Full) Shader Network” (at the bottom of that image) has what you’re after, I think. If it’s not clear from that just post again here, or email me (not sure about PMs - the PM system here seems to have trashed all my messages a while back).

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 31 December 2014 08:41 AM   [ Ignore ]   [ # 5 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

Just cranked up DS - here’s the relevant bit of the “DMS (Full)” shader - a screenshot of the ShaderMixer pane (DS4.5) with the bricks expanded.

Note that ‘Base/Top Reflection Colour’ do NOT appear on the Parameters tab in the normal UI because they’re driven by the “Map Raytrace Mix” brick over to the left.

Image Attachments
Reflection_Color.png
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 31 December 2014 09:06 AM   [ Ignore ]   [ # 6 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

I think that simply adding two bricks (outlined in red here), one between the “Map Raytrace Mix” and “Base Reflection Colour”, the other between the “Map Raytrace Mix” and “Top Reflection Colour” (i.e. the two brown connections in the previous image) should get you on the right track.

Image Attachments
Untitled.png
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 01 January 2015 04:15 AM   [ Ignore ]   [ # 7 ]
Active Member
RankRank
Total Posts:  491
Joined  2005-11-06

Thanks very much Pete!:) I’ll have a go soon and see how that works. Might not get to it for a few days.
Happy New Year!:)

 Signature 

BEGINNERS TUTORIALS FOR BRYCE
MY DAZ 3d STORE  for Bryce & DAZ Studio Materials and Shaders
BRYCE ARENA News and resources for Bryce

Profile
 
 
Posted: 02 January 2015 02:05 AM   [ Ignore ]   [ # 8 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

Happy New Year to you too.

A bit more info - a screenshot of the relevant bits of the modified DMS(Full) ShaderMixer pane again. This time I applied it to an object and rendered to check that it works.

1) Add two new ‘color multiply’ bricks - Insert > Bricks (Default) > Functions > Mathematical > Binary Operation and set Type to Color and Opertation to Multiply.

2) Connect the Output of the ‘Map Raytrace Mix’ brick to the ‘Value 2’ input of each.

3) Connect the Binary Op Result outputs of these bricks to the existing “Base/Top Reflection Color” bricks.

4) Rename the existing “Base/Top Reflection Color” bricks as existing “Base/Top Reflection Color Mix”.

5) Rename the two new bricks as “Base/Top Reflection Color” (these are where the user inputs for setting reflection colours are)

6) Double click the name of the Value input of each new brick and set Label and Path as shown, and set Default and Value to white. (Setting Path to “Base Texture/Reflection” makes the “Base Reflection Colour” parameter appear on the parameters tab in the UI nested under Base Texture > Reflection)

Image Attachments
smview.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 02 January 2015 02:13 AM   [ Ignore ]   [ # 9 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

And a screenshot (or actually a couple of screenshots combined) of a DS4.6 render of a scene with just a sphere primitive using this modified DMS (Full) shader. I modified the reflection strengths and colours from the Parameters tab, and also applied a checkerboard mask. The relection you see is the default reflection map included in the shader - the colouration is from those new “Base/Top Reflection Colour” parameters.

Edit: the render’s not particularly good, but I was just trying to prove the principle - and for that it was good enough!

(Edit: a few tests I did on the other thread two years ago indicated that reflections don’t work very well if the reflective layer has a dark diffuse colour. I think this was more to do with the way DAZ Studio does reflections than anything specific to the shader - although I may be wrong.)

(Edit 3: I’ve now got my sleeves rolled up and I’m pulling the shader apart - there’s something odd happening with the reflections, and I’m not yet sure if it’s an old bug in DS, or something stupid I did…  :oS More details (back to square 1 with DS reflections)in the other thread starting at post 23 ... )

Image Attachments
ui.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 07 January 2015 09:45 PM   [ Ignore ]   [ # 10 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

There’s definitely something odd with the way ShaderMixer handles reflections (at least as recently as DS4.6.1.17Pro, which is the latest version I’ve got installed). There appear to be two separate problems - see posts #21 to 24 of the “Was there ever a non-beta Shader Mixer for DS3A?” thread if you really, really want to know more…

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 10 January 2015 08:59 AM   [ Ignore ]   [ # 11 ]
Active Member
RankRank
Total Posts:  491
Joined  2005-11-06

Hi Pete thanks very much for your detailed explanation of what to do.  It was really helpful. I set up the new bricks today and it appears tow work really well. I find that the shader works pretty much as the default DS shader. Regarding the behavior of the reflection colour you posted in the other thread, it has always appeared that way to me (i.e. isn’t the background colour that’s reflected but is a colour filter applied to raytraced reflection).

I’ve not personally found any problems with darker colours,i.e. if I create darker metal shades they seem to work as the lighter colours. One thing I have notice though is that for general reflection purposes i.e. if you have a reflective surface in a scene the reflections from other non-metallic objects appear fine. However, there appears to be a difference from the default shader if you use a shader mixer reflective surface under a shader mixer reflective object - see screenshot:

The sphere on the left is metal made with the default DS shader - one on the right is using the dual layer one in shader mixer, and the ground plane also.  You can’t use identical settings - the shader mix one needs to be tweaked to get near identical results. That’s not a problem though.

But, if you look at the reflections in the ground plane you can see the reflection of the shader mixer sphere on the right has a darker area where the bottom of the sphere is being reflected, whereas the full sphere is reflected for the DS default material sphere on the left. This is true if you apply a reflective default DS surface on the ground plane too.

What does this mean? Lol no idea. I just noticed it and thought it was interesting. I tired different lighting angles too, but it remains the same.

Image Attachments
Capture1.JPG
 Signature 

BEGINNERS TUTORIALS FOR BRYCE
MY DAZ 3d STORE  for Bryce & DAZ Studio Materials and Shaders
BRYCE ARENA News and resources for Bryce

Profile
 
 
Posted: 10 January 2015 10:24 PM   [ Ignore ]   [ # 12 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

Hi Eva,

There’s definitely one BIG mistake I made in the environment mapped reflections on ALL my ShaderMixer shaders.  :oS (but the solutions quite simple smile  )

It was pointed out by millighost in post #28 of “Was there ever a non-beta Shader Mixer for DS3A?”, and I’ve confirmed that solution for myself. You need to add a ‘Reflect’ brick and plug that into the ‘Vector’ input (you need to tick ‘Advanced’ to see that input) of the brick I named ‘Reflection Map’ (which is actually an ‘environment color map’ brick) via an intermediate ‘NTransform’ brick. There’s still something not quite right, but it’s now a much smaller problem than before.

Regarding the black diffuse, it looks as if it’s related to the ‘Lighting Model’ - see millighost’s post #38 of “Was there ever a non-beta Shader Mixer for DS3A?”.I’m just going to do a few tests to see if I’ve understood that post correctly. (Edit: yes, it was simply that I’d overlooked ‘lighting model’.)

And the missing reflection on your right-hand picture?  I’ll see if I can reproduce that, and then see if we can find a solution…  smile

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 11 January 2015 01:52 AM   [ Ignore ]   [ # 13 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

Here’s a first very simple test.

In both renders the left sphere is a standard material, and the right sphere uses my original ‘DMS (Full)’ ShaderMixer

In the first render the plane is the same material as the left sphere, i.e. a standard material. This looks as I’d expect - i.e. the reflections of both spheres look similar.

In the second render I changed the plane to use the same ShaderMixer material as the right sphere. The result of that, although rather different from your render, DOES show distinctly different reflections from the two spheres. I think that’s a lead that might be worth following.

So my first guess is that your strange result might be something to do with the settings of the trace brick (the one I labelled ‘Reflection Trace’) - i.e. Raytrace Sample Cone, Max Distance, Raytrace Samples, and/or Bias. Simply changing ‘Raytrace Sample Cone’ from 1.0 (default) to 0.1 I was able to get a render very similar to the first setup.

Image Attachments
!1.jpg!2.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 11 January 2015 08:26 AM   [ Ignore ]   [ # 14 ]
Active Member
RankRank
Total Posts:  491
Joined  2005-11-06

Hi Pete. I tried setting the Raytrace Sample Cone from 1.0 to 0.1. The default was actually set at 0.0, but either setting didn’t seem to make a difference to the dark area reflection. Were you using the mulit-layer shader, because you mention mid layer: I’m using the dual layer with bottom layer active. I don’t know if that would make any difference. Also I’m using DS 4.6 Pro (not upgraded to 4.7 yet).

I was also wondering if it’s a render settings difference (though I doubt it)  - here’s what I’m using:
Max ray trace depth - 1
pixel samples - 4
shadow samples - 22
shading rate 0.4
gamma correction off
gain 1.0

 Signature 

BEGINNERS TUTORIALS FOR BRYCE
MY DAZ 3d STORE  for Bryce & DAZ Studio Materials and Shaders
BRYCE ARENA News and resources for Bryce

Profile
 
 
Posted: 12 January 2015 12:50 AM   [ Ignore ]   [ # 15 ]
Active Member
Avatar
RankRank
Total Posts:  560
Joined  2007-09-01

I was using the ‘DMS(Full)’ shader from my ‘S.E.Asian Shields’ (that later version of my SDMS/STMS was a three layer one, but I included a two-layer version with just the Base and Mid layers).

I’ve just dug out the original ‘SDMA(Beta04).duf’ shader and tried using that…

First image is my resulting render (I’m still using DS4.6 too) - everything seems fine to me, and I don’t see anything similar to the effect you see.

Second image is the render settings I was using.

Third image is the same setup as the first but with your render settings (I think you must have made a mistake when you noted them down, as I think you need a raytrace depth of >1 to get reflections of reflections !  smile ). I don’t think it’s the render settings.


My next guess is that it’s something specific to your material settings. You could try and duplicate my simple setup - it’s just two sphere primitives and one plane primitive (no lights, so it’s the default DS lighting). Then add a third sphere with your material. If that all looks okay then try applying your material to the plane too.

(EDIT (see next post, start of page 2) - Is it something to do with shadows? )

Image Attachments
SDMSBeta04TestRender.jpgSDMSBeta04TestSettings.jpgEvasSettinsRender.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
   
1 of 2
1