PDA

View Full Version : Texturing a terrain (texture splatting?)



jmanuelexe
07-21-2012, 06:26 AM
Hello, everyone

I am working on terrain editor but interested on a way to improve appearance and performance so I put it on a octree, now the texture doesn't look convincing to then I saw the farcry map editor on youtube http://www.youtube.com/watch?v=8pkicqIO-8I what I deducted from it is that they are using maybe texture splatting but then every texture would be drawn as independent squads so they wouldn't be using share texture coordinate making it hard use vertex share
818
so I was thinking if there is a way to generate the texture coordinates on a shader maybe, I though on using gl_VertexID to identify vertex but that doesn't exist on OpenGL ES any help on this?

Bloodust
08-23-2012, 11:43 PM
then every texture would be drawn as independent squads so they wouldn't be using share texture coordinate making it hard use vertex share
nope
You have, for example, 4 color textures and 1 splat texture. You read the splat texture and decide which color texture should be used for this fragment.
Example here http://supcom.wikia.com/wiki/Height-_/_Texturemaps_with_image_editing_tools#Texturemap

The color textures are tiling so they can all use same texture coordinates.

thokra
08-24-2012, 03:19 AM
The problem with using 4-channel splatting texture where each channel is exactly attributed to a single albedo map is that, well, you can have at max 4 albedo textures with this approach. An alternative is what's also called stenciling where each albedo map is assigned a single stencil. You can reduce the stencil size substantially if you don't need pixel-precise mappings of color (which most users won't give a damn about anyway) and compress them well since for most stencils the prevalent color will be black.

For simple examples, the single splatting texture approach is ok though.

jmanuelexe
08-29-2012, 11:36 AM
My confusion was since in texture splatting you have a many big square area like regions where many small quads which would have to 1 or 3 texture like grass dirt etc, would be cover with just one alphamap per region I thought I have to draw every small tiling one as separate squads now I realize that I only need to scale the textures so it could be use as many small tiles and the use the alphamap with no scale (which is a small texture too stretch)that cover the region, like that works great and few memory was use obviously only 4 texture could be use for each regions assuming not using cube maps which for me it kind of defect the purpose of reducing the texture size.


The problem with using 4-channel splatting texture where each channel is exactly attributed to a single albedo map is that, well, you can have at max 4 albedo textures with this approach. An alternative is what's also called stenciling where each albedo map is assigned a single stencil. You can reduce the stencil size substantially if you don't need pixel-precise mappings of color (which most users won't give a damn about anyway) and compress them well since for most stencils the prevalent color will be black.

For simple examples, the single splatting texture approach is ok though.

how those that work?

thokra
08-29-2012, 02:12 PM
In my last post I mentioned pairing a stencil texture, basically a single channel map, with a color texture with reduced resolution. Thinking about it and taking it a little bit further, you can still go and use multiple RGBA textures als stencils textures packing 4 stencil values. Just increase the number of RGBA textures. You can map each RGBA stencil texture, or splatting texture or whatever, to 4 color textures, 2 RGBA stencil textures to 8 colors and so on.

The benefit is: more applicable color maps while packing all information into 4 channels of each stencil texture.
The drawback: higher memory usage, more texture fetches -> higher bandwidth requirements.

Plus, the more color textures you can access, the more potential ALU work may be incurred. Say you got 2 stencils, and a you determine that at a fragment you have all 8 color maps influencing the fragment -> 8 multiplies (each color is weighted by a non-zero stencil value) and 8 additions (add all weighted colors to produce the fragment color) in a brute force approach. And this is only albedo. No lighting and stuff yet.