Scale and scatter files inside Standalone?

Generic forum to discuss Octane Render, post ideas and suggest improvements.
Forum rules
Please add your OS and Hardware Configuration in your signature, it makes it easier for us to help you analyze problems. Example: Win 7 64 | Geforce GTX680 | i7 3770 | 16GB
Post Reply
Zay
Licensed Customer
Posts: 1129
Joined: Sun Jan 17, 2010 2:53 am

When rescaling objects in standalone is there any way to get the scatter files follow the rescale?
I don't have the scene anymore for my 3D app to generate new scatter files, so is there any way I can recalculate the scatter file inside Standalone when rescaling objects that uses the scatter files?
Win 11 Pro | i5 12600K | 32GB ram | 2x GTX 1080Ti + 3080Ti - studio driver 560.94| Modo/Blender/ZBrush/Daz/Poser
User avatar
haze
OctaneRender Team
Posts: 1003
Joined: Sun Feb 08, 2015 8:57 pm

If I understand correctly, you have a scatter node connected to a placement node, and you'd like to rescale your scatter files and get them out again. Here is a lua script that will do it. Create a placement node, connect it to the output pin of the scatter node, make the changes in the placement node, then ensure it is still selected and run this script - it will create a new scatter node with your placement node's changes made to it. Then you can copy the transforms from this scatter node.

Code: Select all

local placement = octane.project.getSelection()[1]
if not placement or placement:getNodeInfo().type ~= octane.nodeType.NT_GEO_PLACEMENT then
    octane.gui.showError("Please select a placement node.", "Select placement")
    return
end


local placementTransform = placement:getConnectedNode(octane.pinId.P_TRANSFORM)
local postMatrix = placementTransform:getAttribute(octane.attributeId.A_TRANSFORM)

local scatter = placement:getConnectedNode(octane.pinId.P_GEOMETRY)
if scatter:getNodeInfo().type ~= octane.nodeType.NT_GEO_SCATTER then
    octane.gui.showError("Script only works for placement connected to scatter node at the moment.", "Error")
    return
end


-- scatter has attribute array A_TRANSFORMS of matrix type
local transforms = scatter:getAttribute(octane.attributeId.A_TRANSFORMS)

local newTransforms = {}

for k,v in pairs(transforms) do
    print("dealing with transform " .. k)
    newTransforms[k] = octane.matrix.mul(v, postMatrix)
end

local bakedScatter = octane.node.create {
    name = "Baked Scatter",
    type = octane.nodeType.NT_GEO_SCATTER
}

bakedScatter:setAttribute(octane.attributeId.A_TRANSFORMS, newTransforms)
Zay
Licensed Customer
Posts: 1129
Joined: Sun Jan 17, 2010 2:53 am

This is awesome! Thank you Haze :)
Win 11 Pro | i5 12600K | 32GB ram | 2x GTX 1080Ti + 3080Ti - studio driver 560.94| Modo/Blender/ZBrush/Daz/Poser
Post Reply

Return to “General Discussion”