we would like to generate a ground covered by different kinds of textures … grass, rock, dirt, road for example …
of course de map is huge… so we can’t apply a simple composed texture on it, without loosing to much precision…
so we made 2 set of UV for the ground …
the first one, just fitting a “cell” of the ground allows texture tilling, keeping local precision of the picture good enought
the second one fitting the entire map, have been affected by a grayscale image (or an image using alpha channel)
the first step we would like to do, is to combine the alpha on the second texture set, with the first one, allowing by this way to seem some rocky areas on grass covered land for example …
I’have read the documentation for a long time and I haven’t find a way to do that … is it possible or should I implement cg-shaders for that specific purpose ?
Without shaders, your closest approximation is to use a third texture to switch between textures A and B, using CMInterpolate mode. If shaders are an option, they’re probably your best bet.
ho … pro-rsoft … every help you can bring to us is welcome of course … I have take a look to CG shader language … but with my poor level in coding … it’s hard enought (basically, i’am a 3D modeler, giving a hand to the code team)
@drwr : the purpose is to make ground composed bye more than 2 textures (the more we can put on it the best it will look) … so the way you describe risk to become very complex but thanks anyway
I have studied cg for days and managed to generate a 3 textures covered land (grass, dirt, and stone) blending using the R,G or B channel of a fourth texture…
the (new) problem I encountered is that it seems to be a limit of 4 textures applied on an objext at the same time …
what can I do if I want to add one or more extra texture on the land … should I divide It into separted meshes (witch can involved problem because the mesh is generated bye heightfield) or is there another way to bypass the limitation … ?
is it possible pour put the four 512x512 texture on a same 1024x1024 pict and modify the coordonates of the sampling point in the fragment shader program ?
[edit] : humpf it seems to be impossible to acces the interpolated texture coordinates of a fragment to adujst it to the right chunck of the composed texture… if anyone know a technic I can use for this purpose … he is welcome
Either create a stage that blends in the primary colour, or call setShaderAuto to enable the shader generator, which doesn’t suffer from the same issue.
First, your dirt texture is set to MReplace, not MModulate, so that it will completely replace the vertex lighting. Similarly, your grass texture is painted with COSrcColor, so the same problem happens.
You should restructure your texture chain so that your grass and dirt textures are the first two textures, and they are applied with MReplace. Then apply the stencil texture as the third texture, applied with CMInterpolate. This will allow the lighting to show through.
Once lighting shows through, your terrain will be almost entirely black, because it is illuminated only by a single spotlight which is only three units above the terrain and pointed straight down. (Use slight.showFrustum() to reveal its position.) So you might want to broaden this light, or better yet, use a directional light (since it is, after all, an outdoor scene).