Dynamic Texture Blending

Started by
2 comments, last by CC Ricers 11 years, 2 months ago

I have no clue of the real name for this so I just made up something that seemed to fit. BTW skip to 36 min in, to see what i am talking about

#t=2183s">
#t=2183s

I was searching through polycount the other day and found this video as well as this topic and it really struck me as something that we should all have the option/access to. Does anybody know how this tech is done?

http://www.polycount.com/forum/showpost.php?p=1518875&postcount=23

Any guidance would be greatly appreciated as we are attempting to try and add in some form of blending. This would be really nice to have for base blocks that connect to the ground or cliffs!

Advertisement

that's cool!

so it looked like as they moved the props around the map the projected textures updated nicely. i couldn't tell for sure but looked like it wasn't just using one of the terrain tiles but had blending between the tiles as well. so assuming the terrain is 2D XY + height the shader for the props would need to transform from its world space XY positions to the UV coordinates of the terrain block its sitting on then run the terrain shader to figure out the color to blend to (likely sampling a blend weights texture and a terrain tile sheet or 4 terrain tile textures).

seems that would work well for surfaces that like the terrain are pretty horizontal. to handle things like vertical surfaces perhaps using triplanar blending would be needed.

could be possible to do this in screen space as well with an inferred or deferred pipeline. like if the material shader wants to blend with terrain it could do the mapping from world position to terrain UV then sample virtual texture/megatexture/clipmap for the terrain blend map and tiles texture array and again triplanar map to handle non horizontal surfaces.

guess:
special material property for relevant geometry (mostly to indicate to use this feature);
when used, it will proceed to try to look up the texture and texture coords of the nearest piece of geometry (probably the harder part);
faces near these vertices will be duplicated, drawing an alpha-blended version on top, probably calculating the alpha based on the distance from the intersecting face.

another possible strategy could involve CSG clipping and deformation:
find all intersecting polys between the object and the ground;
clip these faces against each-other;
allow the faces to pull on any newly created vertices (to smooth out edges), while keeping original vertices anchored;
make alternate versions of each poly, one set using the original textures, the other using the opposite sides' textures (probably per-edge);
for this second set of polys, use alpha blending or similar, and possibly subtract this alpha from the first-level's alpha (depends some on how lighting/... is performed).

With what was said previously, using the extents of an AABB could aid in determining texture coordinates in respect to the terrain. Take the XZ coordinates of the four sides and get the UV values this way. With the object's height, then you just set a coefficient for the blend distance. A large coefficient will have the grass blending all the way to the top.

New game in progress: Project SeedWorld

My development blog: Electronic Meteor

This topic is closed to new replies.

Advertisement