I need to scale a model accoring to it’s normals instead of normal scale.
In blender you go in editmode, select all and click alt+s. This works, but that would meen that I have to have duplicated models of everything in my game. So instead I need to scale it in jme.
Is there a method?
If not then how do I find the normals from a mesh?
What is the overall effect you are trying to achieve? It sounds like this would make the model look puffy. Concave sections might even close up and/or flip inside out.
Note: this would be trivial with Lemur’s DMesh class but you will potentially run into problems with concave sections that invert. If all you want is a vertex+normal solution then using DMesh would only be a few lines of code to do this.
Only problem is that I need the mesh from a spatial, so I do like this:
Geometry model = (Geometry) MainGame.getAsset().loadModel(“models/”+name+".j3o");
This has worked before, maybe it doesn’t work in android?
Because when I do (Geometry) then it hogs up.
No error message or anything. Am I suppose to do this some other way?
@Addez said:
Thanks everyone :D
DMesh seems to be the way to go :)
Only problem is that I need the mesh from a spatial, so I do like this:
Geometry model = (Geometry) MainGame.getAsset().loadModel(“models/”+name+“.j3o”);
This has worked before, maybe it doesn’t work in android?
Because when I do (Geometry) then it hogs up.
No error message or anything. Am I suppose to do this some other way?
Your model is probably a Node with multiple nodes and geometries underneath it. You will have to traverse and find the geometries. There are classes to help do this already but the recursive way is not hard to write.
Did you know you can do this with a vertex shader if you want to move this computation into the GPU? For a cartoon effect, you rerender the objects you want to have the cartoon effect and tell the vertex shader to expand each vertex along its normal by a small amount. Then you cull the front facing polys and draw the back facing polys with the color you want the outline.