Forums > Jitter

How to tile textures for 3dmodels in Jitter?

May 21, 2013 | 11:48 am

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?


May 21, 2013 | 12:04 pm

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.


May 21, 2013 | 12:12 pm

:-/

"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


May 21, 2013 | 12:42 pm

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.

<code>

– Pasted Max Patch, click to expand. –

</code>


May 21, 2013 | 1:18 pm

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).

 


May 21, 2013 | 4:02 pm

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

Attachments:
  1. tiledUVs.zip

May 22, 2013 | 2:03 am

Thank you for your patch. I adapted it to how I understand how to approach texture tiling with jit.gl.material:

<pre><code>

– Pasted Max Patch, click to expand. –

</code></pre>

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.


May 22, 2013 | 11:28 am

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)

<code>

– Pasted Max Patch, click to expand. –

</code>


May 22, 2013 | 1:02 pm

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?


May 22, 2013 | 2:00 pm

sure thing.
send the "export_material" and "import_material" messages as args to the "sendmaterial" message.


Viewing 10 posts - 1 through 10 (of 10 total)