Notifications
Clear all

[Closed] ambient reflective occlusion map problem

Hi. I am trying to make global ambient occlusion material controller. The idea is simply
1.Applying ambient reflective occlusion to ambient map of all materials in the scene.
2.If there is no diffuse map copy the diffuse color to ambient occlusion map’s bright
3.Then if exist copying diffuse map to the bright channel of the ambient occlusion map as instance.
But but I cannot copy the diffuse map to the bright cannel of the ambient reflective occlusion map and I do not know how to make two materials instanced. the code as follows

   the code
   macroScript Macro2
          category:"DragAndDrop"
          toolTip:""
      (
          
          sm_ = sceneMaterials
          for i = 1 to sm_.count do 
          (
           if sm_[i].diffuseMap == undefined then
     (
   	  sm_[i].adTextureLock = off
   	  sm_[i].adTextureLock = off
   	  sm_[i].ambientMap = Ambient_Reflective_Occlusion__base ()
   	  sm_[i].ambientMap.Name = "amb_"+i as string
   	  tmpdif_  =  sm_[i].diffuse
   	  sm_[i].ambientMap.bright = tmpdif_
     )
          else 
     (
   	  sm_[i].adTextureLock = off
   	  sm_[i].adTextureLock = off
   	  sm_[i].ambientMap = Ambient_Reflective_Occlusion__base ()
   	  sm_[i].ambientMap.Name = "amb_"+i as string
   	  tmpdif_  =  sm_[i].diffuseMap
   	  sm_[i].Maps.ambientMap.bright.shader   = tmpdif_
     )
      
          )
      )
      
    

The last line of the code causes error message
– Unknown property: “Shader” in (color 255 255 255)

How can i copy the diffuse map to the ambient occlusion map’s bright channel. and how can I make them instanced. Can anyone help me whit this.

1 Reply

I found it.I was tryning to edit wrong property of the ambientMap.the last line shold be like this.

	sm_[i].ambientMap.bright_shader   = tmpdif_

Thanks anyway.