Use SplattingManager to do splatting on (non terrain) meshes

pilo

29-03-2008 21:38:02

First of all feel free to point me in a different direction if what I am trying to do is ridiculous or backwards somehow.

I am trying to use SplattingManager to add splatting to arbitrary meshes that aren't necessarily the terrain. I want players of my game to be able to "paint " all the objects in the world dynamically in game. They can draw on the ground on buildings on rocks etc.

What I am trying to do right now is modify the ETSample program that comes with etm to see if I can do splatting on a mesh that I am loading. The first thing that I tried is to load a mesh called avatar.mesh who's avatar.material is just a copy of ETTerrain.material but this resulted in the model being all black.

I am very new to this and would appreciate any help or suggestions, thanks in advance.

CABAListic

29-03-2008 21:49:53

Nothing wrong with the idea in principle if it makes sense for you. The SplattingManager just manages a texture, whether it's applied to a terrain or another mesh is irrelevant to it. Only problem I see is to determine the paint position on an arbitrary mesh.

Having said that I don't know why your mesh is all black; it might be that you need to adjust the vertex shader as that's the one which is tied to terrain. Try to remove it from the material.

pilo

29-03-2008 23:29:55

Thanks a lot for the reply,

The problem was that the mesh was looking for a material of a different name, now it uses the proper material and I can use splatting perfectly.

The problem I have now is exactly what you pointed out, finding the proper paint position on the mesh. Right now I am using a guess and check method which is not acceptable.

If anyone has any ideas on how to get a texture coordinate that is nearest to an in-game coordinate for a given entity I would be very grateful.

CABAListic

30-03-2008 12:06:53

Basically you have to find the triangle your ray cast hit and then interpolate the UV coordinates from the three vertices forming the tri. This is not a trivial task, though, and I'm afraid it's out of my league.
Maybe this thread can point you in some directions: http://www.ogre3d.org/phpBB2/viewtopic. ... st+texture

pilo

01-04-2008 08:48:44

I got it working today, thanks so much for your help. The post you linked to was perfect and had everything I needed.

Thanks again, and splatting manager is working great (we will see if this is a practical solution once I get it out of my little sample executable and into the game :wink: )