2
\$\begingroup\$

I'm trying to edit large amounts of vertex attributes in my models for my game. The main attributes I really care about are strength (so wind can interact with them) and a couple of other things so the interaction with wind looks decent.

However, I'm not quite sure how do edit them easily. Of course I could manually write all of them, but that would be ridiculous. My first thought was to use a format in Blender that I could just export vertex colours and use the value as the attribute value.

Here's a picture for example (red = leaves, very windy, strength = 0.1; green = wood, strength = 0.7)

enter image description here

I don't really see any problems with this other than the fact I don't know of any formats, but I'm sure I can find some.

Is is there any way (or any program that can do this easier)? Or is the way of just colouring them the best way to go.

\$\endgroup\$

2 Answers 2

3
\$\begingroup\$

If you use weight painting instead of vertex colors, you could export the model in any format that supports skeletal animation.

\$\endgroup\$
5
  • \$\begingroup\$ I tried something like this, but instead of using a skeletal animation format, I just heavily edited the .ply format to only export the vertex paint colours. It was really nice to paint with and easy to parse. Only problem though is that the colours seem to be bytes, not floats in Blender. In vertex paint its fine, I can can write any float value, but Blender seems to convert it to bytes. I know this is a bit more of a Blender question, but would you perhaps know how to make Blender use float values instead of bytes? Its not a huge problem, but it does cause a few problems. \$\endgroup\$
    – J4S
    Jul 18, 2017 at 19:27
  • \$\begingroup\$ @jason I don't have the exact script handy, but looking at developer.blender.org/diffusion/BA/browse/master/io_mesh_ply/… I'd remove line 119 where it's convering the native float to bytes for PLY export \$\endgroup\$
    – Jimmy
    Jul 18, 2017 at 20:05
  • \$\begingroup\$ I tried removing them to no avail, it would seem that Blender seem s to be changing them before they're exported. I'll try to see if theres anyway to change this \$\endgroup\$
    – J4S
    Jul 18, 2017 at 20:35
  • \$\begingroup\$ well, you also have to change the "%u" to "%f" down where it's writing it to the file on line 170 and (I'm guessing here) the "property uchar" to "property float" for the red/green/blue properties on line 155 \$\endgroup\$
    – Jimmy
    Jul 18, 2017 at 20:38
  • \$\begingroup\$ I feel a little stupid now, but it works perfectly though! Thank you! \$\endgroup\$
    – J4S
    Jul 18, 2017 at 23:15
3
\$\begingroup\$

You could simply use multiple textures on the vertices, where each channel of each texture contains the value of some attribute. Then you can paint the attributes in any program that allows you to paint a texture on a model. You can have 4 attributes per texture. In your vertex program you can sample the texture to get the attribute values at that location.

\$\endgroup\$
2
  • \$\begingroup\$ I was considering doing something like this, but isn't texture binding a pretty big overhead? I'm not quite sure performance wise if texture binding or vbo binding would cause more problems. Is it insignificant, or should I worry? \$\endgroup\$
    – J4S
    Jul 18, 2017 at 19:24
  • \$\begingroup\$ I'm not aware of texture binding being a performance bottleneck, but the best way to know is to try it out and see. Uploading or downloading textures can be a bottleneck if not handled with care. But if you upload the textures before you need them and keep them in VRAM while using them, I wouldn't think it would be an issue. \$\endgroup\$ Jul 19, 2017 at 2:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .