Hello,
I’d like to discuss a thing where i seem not to find a satisfying solution.
The Objective: Change Texture or swap UVs on the ground where a building was build on.
What I wanted to do was basically to change the ground texture on an area nearby where a building was set up like in warcraft 3. Please review the video and observe the texture underneath buildings. http://www.youtube.com/watch?v=X6reixTdNQY&feature=results_main&playnext=1&list=PLF474571BBC67C186
I reviewed many methods, aswell asked a professional programmer but all that I got was either a really hard solution or not satisfying ones.
This is what i’ve already tried:
-
setup a quad mesh underneath the building with appropriate texture = the mesh has to be at least +2y higher than the buildings pivot point in order not to start clipping with the surface. So this didnt really well for me.
-
Setup a projector which uses a special shader that i grabbed on the unify wiki. This does what it should but as this is a projector the color appearance is way to bright.
The hint that the professional gave me: generate terrain procedurally and apply to certain vertex groups UV coordinates which represent tiles, in order to find out which tiles you want to build on i’d need to determine via raycast and some crazy maths which vertex and uv groups are affected and then swap out relative UV coordinates.
Well it’s not that i couldn’t solve this (after time X=ages), the problem is more that i don’t want to as my map needs to have colliders, waypoints and setting those things manually is better than determining per code differently for each level.
Now after all this fails I’m thinking about another approach
I try to create in a 3d application a Nullobject which does contain as many quad meshes as i need there to be and generate a single uv map for those, then ingame raycast against quads and swap out their UVs with the UV coordinates of the texture i want to represent underneath the building.
Contra: I will never be able to use nice huge textures which make the surface look variating and that cover the whole terrain but rather have to use rpg like tile textures.
QUESTION: Is there any way to deal with this problem that i get a solution which is similiar to Warcraft3 or actually does look good besides not doing it at all ? :razz:
Here’s a screenshot of my current state with using the modified projector in order to present ground texture.
Cheers,
Apprentice