Digital Art Zone

 
     
genesis and double side shading feature (question)
Posted: 16 June 2012 03:08 AM   [ Ignore ]
New Member
Total Posts:  16
Joined  2006-01-17

I want to know how to use double side shading feature of 3Dlight in DS4 against genesis.

My shader uses double side shading feature of 3Dlight in DAZ Studio4.
It works for A3, belbel, V4,and so on.
But it does not work for genesis.

If anyone show me code how to do it, I am very very very happy.

Thank you for your reading.

Profile
 
 
Posted: 16 June 2012 04:43 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13579
Joined  2003-10-09

It should just work, especially if it works for some items. What exactly are you doing, and what are you getting as as result?

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 16 June 2012 12:48 PM   [ Ignore ]   [ # 2 ]
Active Member
Avatar
RankRank
Total Posts:  803
Joined  2007-01-08

If you have the DS4.5 release candidate it contains the Ambient Occlusion scripted renderer scripts that do include a command about double-sided surfaces.
However, since it works for you for older figures, it’s probably just a Genesis bug.

Profile
 
 
Posted: 16 June 2012 07:36 PM   [ Ignore ]   [ # 3 ]
New Member
Total Posts:  16
Joined  2006-01-17

I put a sample shader at http://www.geocities.jp/nyankko15/DAZStudio/tmp/doublesidetest.zip
It contains sourcecode.

keypoint are 2.
1.  code :  Shader.setIntegerAttrib(“sides”, “integer doubleshaded”,1);
    where: scripts/support/Eilir/s2_test/s2_simple_surfaceAttribs.ds

2. in shader suorce code
  determine whetter it is forward sourface or reverse surafce
  by sign = sign(N.Ng);

  code snippet:

  float sign = sign(N.Ng);
  ....
  if(sign >=0){
Oi = Ot;
Ci = Oi*Ct;
  }else{
Oi = rOt;
Ci = Oi*rCt;
  }

result:
by this shader , I can set forward color , forward opacity, reverse color ,reverse opacity.
If I apply this shader to sphere and
  set forward color red and revers color blue and forward opacity 1 then sphere is painted by red
  and if set forward opacity 0 then shpere is painted by blue,
but if I apply this shader to Genesis,
If I set forward opacity 0 then Genesis is not painted.transparency at all.
It should be painted blue.

By this result ,  I think
  sign = sign(N.Ng);
is >= 0 allways

I wonder why this is occure.
Perhaps keypoint 1 does not work against Genesis.
About Genesis , RIB structure is deferent from other figures.
When I set renderoption to RIB output,  I can see Genesis
structure is deferent from other figures.
I think it affect to keypoint1.

If I converted(Exported) Genesis to Poser and load on DS4
then the shader works . Because exporeted Genesis’s Structure
is same as other figures.
But Exproted Genesis is not good for DS4.

Perhaps there is a way to use double side shadiing against Genesis sturucture
I want to know the way how to do it. Realy very very much.

Thank you for your reading, thinking.
PS this shader is generated by Eilir (for DS2) and compiled by DS4’s RSL Editor

Profile
 
 
Posted: 17 June 2012 11:11 AM   [ Ignore ]   [ # 4 ]
Active Member
Avatar
RankRank
Total Posts:  803
Joined  2007-01-08
NyaNyan - 16 June 2012 07:36 PM

PS this shader is generated by Eilir (for DS2) and compiled by DS4’s RSL Editor

I think this explains actually. In the days of Eilir, the geometry of the existing figures (up to V4/M4) was attached to nodes, but in Genesis the geometry is on the root so the support scripts probably return no geometry.
I found this in My Library/shaders/s2_test/s2_test.ds which may be one of the culprits:

function processMaterialsoNodeaMaterials ){
  
var oObject oNode.getObject();
  if( 
oObject != undefined ){
   
var nShapes oObject.getNumShapes();
   for( var 
0nShapess++ ){
    
var oShape oObject.getShape);
    if( 
oShape != undefined ){
     
var nMaterials oShape.getNumMaterials();
     for( var 
0nMaterialsm++ ){
      
var oMaterial oShape.getMaterial);
      if( 
isInArrayByNameaMaterialsoMaterial ) != -){
       buildMaterial
oShapeoMaterial );
      
}
     }
    }
   }
  } 

I’m not knowledgeable enough to fix it myself. confused

Profile
 
 
Posted: 17 June 2012 12:10 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13579
Joined  2003-10-09

I’m not sure if that is the root, but if it is you might try something like this instead of var oObject = oNode.getObject();

var oObject oNode.getObject();
if ( 
oNode.inherits"DzBone" ) ) {
 
if ( oNode.getFigure().inherits"DzFigure" ) ) {
  oObject 
oNode.getFigure().getObject() )
 
}

However, I think that would risk rendering the same object multiple times - if possible it would be better to handle this at the nod gathering stage, so that there was a single oNode for each Genesis (or other TriAx) figure, rather than one for each bone.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 18 June 2012 06:11 AM   [ Ignore ]   [ # 6 ]
New Member
Total Posts:  16
Joined  2006-01-17

Thank you for your reply.
I have not enough knowledge but I will try as soon as I can have time.

Profile
 
 
Posted: 23 June 2012 11:22 PM   [ Ignore ]   [ # 7 ]
New Member
Total Posts:  16
Joined  2006-01-17

I tried

var oObject = oNode.getObject();
if ( oNode.inherits( “DzBone” ) ) {
if ( oNode.getFigure().inherits( “DzFigure” ) ) {
  oObject = oNode.getFigure().getObject() )
}
}

then parse error occured when reading scirpt file..
I replaced “)” to “;” as follow

var oObject = oNode.getObject();
if ( oNode.inherits( “DzBone” ) ) {
if ( oNode.getFigure().inherits( “DzFigure” ) ) {
  oObject = oNode.getFigure().getObject() ;
}
}

then

Executing DAZ Script file: C:/Documents and Settings/saito/My Documents/Daz 3D/Studio/My Library/Shaders/_Eilir Custom Shaders/test/s2_test/s2_test.ds
WARNING: Script Error: Line 405
WARNING: TypeError: Result of expression ‘oNode.getFigure’ [undefined] is not a function.
WARNING: Stack Trace:
<anonymous>()@:405
Error in script execution!

occured when read script file.


And by the way
with original script file
at forward surface the shader works well.
Only at reverse surface the shader don’t work.

Profile
 
 
Posted: 24 June 2012 07:49 AM   [ Ignore ]   [ # 8 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13579
Joined  2003-10-09

Sorry, that’s what comes of working from memory - getFigure() should be getSkeleton()

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 25 June 2012 06:25 AM   [ Ignore ]   [ # 9 ]
New Member
Total Posts:  16
Joined  2006-01-17

Thank you.
But result of rendering is the same as original script.
if forward opacity is 0%  then not painted at all ( reverse opacity is 100%)
where it should be painted by reverse color.
If forward opacity is 100% then painted by foward color.

Profile
 
 
Posted: 27 June 2012 02:29 AM   [ Ignore ]   [ # 10 ]
Active Member
Avatar
RankRank
Total Posts:  803
Joined  2007-01-08

I’d file a bug report and/or send a PM to ketthrove, he’s the most likely to know what is wrong.

Profile
 
 
Posted: 27 June 2012 06:40 AM   [ Ignore ]   [ # 11 ]
New Member
Total Posts:  16
Joined  2006-01-17

Ah, yeah
But Eilir is a free soft , and commercial version of it is a shader mixer and shader builder.
He has no responsibility to do anything at all.

Profile