Quote:
The speed issue in this is due to the 12 texture lookups in the fragment shader when using 4 textures. If you can get away with say 2 textures that would be a good thing
- Yeah figured, Ill manage.
Quote:
You could do it based on any metric you want
I would think, however, that doing it based on distance (I assume you mean distance from the camera) might look a bit weird since the ground type (dirt/rock) would change as the camera moves around.
Yes I need the texture up close ( to the came) to be shown only with in a fix pixel range. And the other only in the distance. I would amuse the texture would not move this th camera so why would it look weird. As long as the texture near wont move or change ( say a 300 pixel radius) and the texture beyond would show another and only when its beyond that radios it should be ok no? Like Torque does and other engines. AKA detail/normal textures. I dont know shader lang well but If you pointed my in the right direction I could figure it out.
Quote:
Well bigger textures generally look better
For the record, the textures used in the screenshot on the wiki are all 512x512.
- I'll try that
Quote:
You can adjust the texture scale by multiplying by a different value in the texture2D() call (eg. texture2D(tex1, triTexCoords.xy*10.0))
Bigger number there will result in the texture repeating more often. You might consider adding another uniform to your material/shader that contains scaling amounts for each of you textures and use those in your call to texture2D (I probably should have done that in the first place.)
Hmm I dont see why I would need to I could just do
Quote:
// grass
tempColor = tpweights.z * texture2D(tex2, triTexCoords.xy*5.0);
tempColor += tpweights.x * texture2D(tex2, triTexCoords.yz*5.0);
tempColor += tpweights.y * texture2D(tex2, triTexCoords.xz*5.0);
finalColor += weights.w * tempColor;
// dirt
tempColor = tpweights.z * texture2D(tex1, triTexCoords.xy*200.0);
tempColor += tpweights.x * texture2D(tex1, triTexCoords.yz*200.0);
tempColor += tpweights.y * texture2D(tex1, triTexCoords.xz*200.0);
finalColor += weights.y * tempColor;
// rock // found 4 ( divisible by height map ) stops some of the stretching.
tempColor = tpweights.z * texture2D(tex3, triTexCoords.xy*4.0);
tempColor += tpweights.x * texture2D(tex3, triTexCoords.yz*4.0);
tempColor += tpweights.y * texture2D(tex3, triTexCoords.xz*4.0);
finalColor += weights.x * tempColor;
and that sets the scale for each no? What am I missing here?
Thx for helping out on this, and PuG I here ya I wrong a bump map shader once. and when I was done although it worked well I didnt understand much of it. I may finally try to understand it a bit.
Brain storming..
Code:
if (cam is far)
{ //detailed texture
tempColor = tpweights.z * texture2D(tex1, triTexCoords.xy*200.0);
tempColor += tpweights.x * texture2D(tex1, triTexCoords.yz*200.0);
tempColor += tpweights.y * texture2D(tex1, triTexCoords.xz*200.0);
finalColor += weights.y * tempColor;
}
if (cam is near)
{// basic texture
tempColor = tpweights.z * texture2D(tex3, triTexCoords.xy*4.0);
tempColor += tpweights.x * texture2D(tex3, triTexCoords.yz*4.0);
tempColor += tpweights.y * texture2D(tex3, triTexCoords.xz*4.0);
finalColor += weights.x * tempColor;
}
I would just need to know how to get the cam distance.If I could just not render that texture it would speed things up but I dont really know where to even begin with shaders. I would needs at least a way to trace some data to figure this out. I think I can get the cam position with
myCam cam_pos;
or use cam_pos[x]
cam_pos[ x(1) y(2) or z(3) ]. I'm not sure if its 0 based or not. I also saw a referenced for cam_pos[4] not sure what that is. I think I only need x and y. I'm not sure how the 2d to 3d translation will work.
Here is the concept I'm after.
http://www.ogre3d.org/forums/viewtopic. ... 6f4e2718c6