You are not logged in.
Hi,
I am tring to make a script that use RenderToTexture.
I muddy when i try to add a rendere elemento to an RttGrop i created:
Example:
-- Create an RTTGroup
RttObj = RTTGroup()
-- Add texture element Complete map
RttObj.AddBakeElement (RttObj.CreateBakeElement "CompleteMap")
The last istruction return true but the textture element list is empty...
Any tips?
Perry
Offline
Hi,
It is necessary to use this form:
RttObj.IRTTGroup.AddBakeElement (RttObj.IRTTGroup.CreateBakeElement "CompleteMap")
The node's interface INodeBakeProperties already have a method with the same name (AddBakeElement).
Some time ago I wrote a small example script that show how to use RTTGroup API, will may be useful for you.
This script (RTTExample.ms) outputs to MAXScript Listener window the mesh material IDs channel - primary and assigned by RTTGroup, and the bitmap filenames for bake elements.
http://www.rendertotexture.com/files/sc … xample.rar
Andrzej
Offline
Thank you very much for the answer!!
But i have another strange problem :p
now i do this:
-----
RttObj = RTTGroup()
cm=RttObj.IRTTGroup.CreateBakeElement "CompleteMap";
cm.enabled=true;
cm.targetMapSlotName = "diffuseMap"
RttObj.IRTTGroup.AddBakeElement cm
------
now add the bake element, if i go in tool and start the render it do it...
but it don't assing the diffuse map...
The really strange think is: If i press texture Elements and close the dialog, in the next render it assign the diffuse map...
strange. Any ideas for this?
Thank you again
Perry
Offline
To set the "TargetMapSlotName" you should use this:
mat = standardMaterial() -- or other material, for example the material from some node
RttObj.IRTTGroup.SetTargetMapSlot cm mat "Diffuse Color"
for every used material type/class.
Thanks,
Andrzej
Offline
Thank you very much!
i am ok for now ![]()
Perry
Offline