How to tile textures for 3dmodels in Jitter?
Hi
Can anymody tell me how to tile textures for 3d models? I am able to get a texture onto a 3d model, but the texture needs to be scaled. Obviously I could create a tiled texture, but thats not very efficient, right?
You could do this using a pretty simple custom shader, but I don't know of a built-in way to apply scaled/tiled textures without manipulating the UVs of the model.
:-/
"pretty simple" sounds fantastic, "shader" not so - more lake serious head scratching.
But thanks, I will dive into it, then...I guess I will start with td.kaleido.jxs
you can override the model's uv coordinates by enabling @tex_map on the model.
tiling is achieved by setting the @wrap attribute of a non-rectangular texture (@rectangle 0) to repeat, or mirroredrepeat.
not sure if that's what you're looking for.
Hmm, close, but its not really what I need. I do have UV's, and dont want to have them generated, and I would like to do it with jit.gl.material, because I also would like to use the hightmap_texture. Usually 3d animation programms (I am using blender) have in their texture settings the ability to repeat (or tile) the image and it is possible to say how many times to repeat in each axis before the newly generated texture it is applied to the models UV's.
Maybe I have to do it the same way, loading the texture, then repeating it, and then apply it to the material. but this gives in my case a very large texture (if I wanna keep the details).
For reference, here's a shader that does texture tiling. It obviously doesn't do all the cool stuff that jit.gl.material does, but if you wanted to go this way, it's not super complicated. In a lot of 3D apps, this sort of thing is part of the default material shaders that are applied when rendering.
AB
Thank you for your patch. I adapted it to how I understand how to approach texture tiling with jit.gl.material:
I am using the td.kaleido.jxs shader with a jit.gl.slab object to tile the texture bevor sending it to the jit.gl.material.
nice solution.
for the record, you can do the same thing with jit.gl.model drawgroup materials (overriding the diffuse-texture for a single material)
excellent. now I also understand the function of "sendmaterial": it allows to access the imported materials with collada files and the likes. is it possible to send a complete material (defined with a jit.gl.material object) to a drawgroup aswell? or even reference it?
sure thing.
send the "export_material" and "import_material" messages as args to the "sendmaterial" message.