Hello everyone, i have to say jMonkey is one awesome tool and i am really thankful for it. Anyways, i am new to this engine and to programming graphics, shaders, vectors, textures and things like that and i dont know exactly how they work. So lets get to the problem. I want to use mesh that was made in Blender as a terrain, since classic terrain with heightmaps was just making problems and it cannot support caves / overhangs etc. So i made my terrain, made UV map, exported it as .obj, loaded with assetManager.loadModel(), created material based on Lighting.j3md and added it to the model, everything works fine, but the problem is that max texture size is 1024x1024px, the terrain texture is really bad quality. So my friend told me there is a technique for it. It should look like this . This is how it should work: I have my normal big texture and then i have also detailed texture. The big texture should be through the whole terrain, like it is now. And then the detailed texture needs some editing in the shader. I need to make it repeat like 100 times and then to multiply it by color from the big texture. He said that the way i ll make it repeat 100 times is that i need to multiple the texture coordinates that i pass to the funkciun sampler2d by 100 hundred. I found this line wich is for diffuseMap wich i think is the method that i need to multiple the coords, but this is for diffuseMap, wich represents my big texture, i need also to pass my detailed texture to the shader and i dont know how to do it. If i add another texture to my material with some custom name, it will just throw error that it cannot find that name. So, is there a way i can pass aditional texture to shader ? I am awere of the fact that i ll need to also make my custom Lighting.j3md and shaders, based on the original ones, but with the changes. I hope u can understand what i am trying to achieve. Thanks a lot for your time.
A variation of that would be to apply a procedural texture for detail (to avoid the inevitable obvious tiling in the distance blues).
Edit: In fact, it would be nice to have a procedural detail that fades out in the distance. No need for the detail on terrain that is lower LoD, is there? But then, the blending colorshift would be obvious… so… Hmm…
The detail texture (from whatever source) would be applied with blending additive. And this sounds to me like it has to happen in the shader, and that has to be set up in the material definition. That is, you need a material that accepts 2 (or more) textures and blends them in a shader.
I got that far on my own, but I, also, am new to Java, jME and shaders in general, so I’m interested in the guidance we see here
I figured out how to accept another custom texture, its pretty easy actually. In your material.j3md u ll just add
where all the declarations are and then u ll add to the same code
[java]DETAILEDMAP : DetailedMap[/java]
where all similiar lines are for DIFFUSEMAP : DiffuseMap, in shaders u ll then use ifdef DETAILEDMAP so i think this thing has something to do with sending textures to the shader.
Then u ll add your texture with name “DetailedMap” to your mat and it wont throw any error. Now i am trying to figure out the actual shader stuff, i ll let you know if i ll accomplish something.
Ok, so here it is Bitbucket . DiffuseMap is set to repeat 2 times and deatiled map to 100 times. On Desktop it works nice, but on the Android almost the same thing happens as with the basic material used for normall height map generated terrain. Its just pixelated. If somebody knows why is this happening, i ll remember his name as long as i can really, i ll hugly appreciate it. So heres the Screenshot on the desktop </br>
And heres the screenshot from android </br>
So, if anyone knows why this happens, please let me know too, thanks.
Ok, so i made a post about this with a little progress on stackoverflow, thinking it is more of a OpenGL-ES Problem then jMonkey: http://stackoverflow.com/questions/20224181/android-opengles-2-0-shader-messed-texture-if-multiplying-texture-coordinates