Results 1 to 2 of 2

Thread: empty shader definition???

  1. #1
    Join Date
    May 2011

    Default empty shader definition???

    Hi all

    I have a very simple shader (right now it doesn't contribute to any evaluation, it is just an attributes container) that is plugged to a geometry shader in this way:

    myShader1.message -> geometryShader.someAttribute[n]

    Here the shader declaration in MI file:

    declare shader
    	color "myShader"(
    		color "color",
    		array shader "bla",
    		array shader "blabla",
    		array geometry "blablabla"
    	#: nodeid 123456;
    	version 1
    end declare
    I created an instance of myShader called myShader1 in maya and made a connection to geometry shader as explained before. Then I used echo call to debug the geometry shader and the scene database. Everything works fine (myShadrer1 declaration in the echoed mi file has all attributes declared and it is connected to the geometry shader) until I add the last attributeattribute:

    array geometry "blablabla"

    Obviously the corresponding c++ file is declared properly and NO code affect this attribute in myShader1 right now. It seems a declaration conflict or something like that.

    Also, if I declare the last parameter as array shader instead of array geometry everything works. And, if I set a particular name to myShader instance in maya it also works.

    Here an example of waht happened in the echoed MI file if I leave the last parameter as array geometry.

    shader "myShader1" "myShader" ()
    Is it possible that the mentalray for maya exporter think that this shader is not important for the rendering (and it really does), so it exports it empty just to keep the connection with the geo shader ? But if this is the reason, why it export it properly if I remove the last parameter?
    Or if a type a particular name? This is unbelievable!!!
    I tried with another simple geoshader with the same structure and If the shader connected to the geometry shader is named "f" it is exported empty:
    shader "f" "myShader" ()
    shader "firstGeoShader1" "firstGeoShader" (
    	"testAttr" [
    	"testbis" 0)
    In the same scene if I rename the shader "n" it is exported with all parameter:
    shader "n" "myShader" (
    	"renderable" on, 
    	"pass_type" 14, 
    	"numChannels" 1, 
    	"frameBufferType" 0, 
    	"filtering" on)
    shader "firstGeoShader1" "firstGeoShader" (
    	"testAttr" [
    	"testbis" 0)
    What is this???
    I have never met this problem before...

    Also (there is something magic) if I remove a struct attr "matOver" (that have a geometry type inside) from the geometry shader the problem disappear and the first attr "testAttr" export properly the connected shader.
    In this way:
    declare shader
    	geometry "firstGeoShader" (
    		array shader "testAttr",
    		#array struct "matOver" {
    		#			geometry "objectOverr",
    		#			material "materialOverr"
    		#			},
    		integer "testbis" default 0,
    		array struct "matList" {
    					material "materialList",
    					shader "shaderList"
    	apply geometry
    	#: nodeid 50000;
    	version 1
    end declare

    Last edited by maradona; October 12th, 2013 at 15:23.

  2. #2
    Join Date
    May 2011


    I found the solution to bypass the problem...

    The first char of the shader name connected to the geo shader has to be < than the first char of the geo shader name.

    For example... this works properly:
    customShader1.message connected in dgeoShader.attr[0]

    In the same maya scene if I rename the geoshader bgeoShader, the customShader translation will produce an empty shader definition.
    The same occurred renaming the customShader1 to ecustomShader1 because 'e' is > than 'd' ... unbelievable...

    The same problem happened using puppet shader replacer, if the material connected has a geometry attribute it is not exported properly... but removing the geo attr or renaming the node as written before everything works...

    Anyone knows the reason? The proble comes up if the customShader has an array geometry parameter. I think it is a scene description limitation, a conflict between geometry shader and geometry attributes
    Last edited by maradona; October 27th, 2013 at 16:03.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts