ShapeBase::setNodeColor() not in T3D; alternatives? (Setting vertex color of entire node)
by Beef Churger · in Torque 3D Professional · 12/26/2014 (10:26 pm) · 11 replies
I've noticed that ShapeBase::setNodeColor() is not a thing in Torque 3D (it was in TGE).
It's fairly essential that I change the colour of specific nodes of my DTS model. How can I go about doing this?
Thanks.
It's fairly essential that I change the colour of specific nodes of my DTS model. How can I go about doing this?
Thanks.
Thread is locked
#2
12/27/2014 (8:06 am)
Do nodes even have colors? Did the function just set the color of all verts weighted to that node?
#3
12/27/2014 (12:29 pm)
Yeah, that's all it did.
#4
An example: if I load MyModel.dae and place it in the world five times and call setNodeColor() on one of them should they all change or just the one?
12/27/2014 (1:10 pm)
It shouldn't be too hard to make. When you call this command are you expecting the alterations to be unique to that particular object? Or does it apply to all instances of the model?An example: if I load MyModel.dae and place it in the world five times and call setNodeColor() on one of them should they all change or just the one?
#5
12/27/2014 (2:03 pm)
Just the one.
#6
github.com/GarageGames/Torque3D/blob/7d376386d1e01790eb57300780d967e8ffcda347/En...
That render function is called per frame and if the skin is dirty (animation changed) it updates the vertex buffer for the mesh. What I would do is maintain some kind of table of node colors and a dirty flag and if it's dirty (from setNodeColor() being called) I'd update the color of all the verts weighted to that node by following the example set by updateSkin(), and finish it off by calling _updateVBIB() to push the updated vertex buffer to the GPU.
If I find time when I get back I'll take a shot at it if you or someone else hasn't got it working.
12/27/2014 (5:18 pm)
I have an idea on how you could do it. I'm still on vacation for a few more days so I don't have my desktop to try anything on. Check out this bit in tsMesh.cpp:github.com/GarageGames/Torque3D/blob/7d376386d1e01790eb57300780d967e8ffcda347/En...
That render function is called per frame and if the skin is dirty (animation changed) it updates the vertex buffer for the mesh. What I would do is maintain some kind of table of node colors and a dirty flag and if it's dirty (from setNodeColor() being called) I'd update the color of all the verts weighted to that node by following the example set by updateSkin(), and finish it off by calling _updateVBIB() to push the updated vertex buffer to the GPU.
If I find time when I get back I'll take a shot at it if you or someone else hasn't got it working.
#7
07/03/2015 (4:27 pm)
Any update?
#8
If the buffer is shared you will colorize all the meshes that share the buffer or break instancing at all.
Just inject a uniform color multiplier into ShaderGen or a color matrix, there are several resource on this topic.
07/09/2015 (1:07 pm)
To update the whole VB just for a single color is nonsense. This may lead to micro freezes depending on the buffer size, because you change the client data, lock the bus and recommit the buffer.If the buffer is shared you will colorize all the meshes that share the buffer or break instancing at all.
Just inject a uniform color multiplier into ShaderGen or a color matrix, there are several resource on this topic.
#9
09/05/2015 (10:35 pm)
Do you think you could elaborate? In hindsight I probably should have posted this in 'Beginner'.
#10
11/14/2018 (7:27 pm)
You there?
Torque Owner Nathan Martin
TRON 2001 Network