Non-repeating (sorta) detail/bump textures...
by Chris \"Hobbiticus\" Weiland · in Torque Game Engine · 01/19/2003 (5:13 pm) · 6 replies
I was playing around with making a per-base-texture detail/bump map, so I figured that I could just load a texture for every material of the terrain. Then, I could blend them together using the blender just like the terrain materials and stick them on the terrain.
However, to get the detail out of the textures, they can't be stretched like the terrain textures are (duh) so I repeat it, but if you think about it, that doesn't look very good ;)
(imagine the terrain texture over a terrain square, shrunk, and repeated)
I got that far, but it's really ugly (quite possibly...fugly)
What I had in mind is have the detail texture repeated where the respective base material is. So, instead of blending one iteration of the texture over the entire terrain square, I'd need to find a way of making that texture repeat only where it's base texture is visible.
First of all, is this even a possibility? I'm thinking that I'd have to make a REALLY large texture for each different terrain square along with editing the asm blender. Any ideas?
However, to get the detail out of the textures, they can't be stretched like the terrain textures are (duh) so I repeat it, but if you think about it, that doesn't look very good ;)
(imagine the terrain texture over a terrain square, shrunk, and repeated)
I got that far, but it's really ugly (quite possibly...fugly)
What I had in mind is have the detail texture repeated where the respective base material is. So, instead of blending one iteration of the texture over the entire terrain square, I'd need to find a way of making that texture repeat only where it's base texture is visible.
First of all, is this even a possibility? I'm thinking that I'd have to make a REALLY large texture for each different terrain square along with editing the asm blender. Any ideas?
#2
Check out getMaterialAlphas in the terrain code. It returns an array of U8s that contain the alpha values for each of the terrain textures. Using this you could either A) pick the highest and use only that detail. B) Blend the detail textures together based on the various alpha values.
01/20/2003 (12:27 pm)
Chris,Check out getMaterialAlphas in the terrain code. It returns an array of U8s that contain the alpha values for each of the terrain textures. Using this you could either A) pick the highest and use only that detail. B) Blend the detail textures together based on the various alpha values.
#3
01/25/2003 (1:31 pm)
I didn't know about the getAlphaMaterials function, but by using that, I'd have to apply twice the number of textures as there are materials being shown in order to get the right effect. I guess it could work, but it doesn't sound very efficent.
#4
01/26/2003 (5:17 am)
What I'd do, is either when the terrain file is saved or loaded iterate over the terrain square by square taking note of the dominate material at that square. Now armed with this fresh alphaMap I'd have essentialy a 256x256 grid of indices into my detail texure list. Then take that list and replace all indices with pointers to the actual detail textures at that index and boom you have easy multiple detail textures for a simple table lookup.
#5
How much money will you charge for it? (please, keep the bids as low as possible because I'm still unfunded). O:)
Best regards, Alf.
04/01/2003 (5:25 am)
I need this feature for my game www.iespana.es/Armada-DigitalHow much money will you charge for it? (please, keep the bids as low as possible because I'm still unfunded). O:)
Best regards, Alf.
#6
It may be possible by loading a material map and maybe doing it in a fragment program, but I wouldn't know how to do it in straight opengl/torque.
If I did do it though, I'd give it out for free. Torque has been great for me - it's the least I can do to give something back.
04/01/2003 (9:13 am)
Well, i found out it's not very possible to do it simply. It'd require a lot of routing around the blenders and terrain render that I simply don't have time for. I DID get it to "work" but the terrain texture scaled down and repeated doesn't look very good if you ask me ;)It may be possible by loading a material map and maybe doing it in a fragment program, but I wouldn't know how to do it in straight opengl/torque.
If I did do it though, I'd give it out for free. Torque has been great for me - it's the least I can do to give something back.
Torque Owner Adam Armstrong
Default Studio Name
Any possibility you could post your changes?