Forums > Jitter

jit.gl.model with jit.gl.texture – looking ugly – help?

May 19, 2012 | 12:50 am

Hi All,

What is the best way to get an image to map onto a torus in jitter? None of the settings that I can find yield acceptable results. It’s very easy to do in Blender, UV-mapped and all. How does one create this effect using jit.gl.model or jit.gl.gridshape with jit.gl.texture? the repeat and etc options get all stretched and weird – lol – I wouldn’t mind a straight repeat/tile.

Also, I have a pretty hi-res image that I’m trying to use as the texture, and no matter what scaling settings I try, I seem to get a very degraded result in my jit.window.

Must be I’m missing a setting or two here both in mapping and scaling or positioning the image.

It would be great to know the correct approach for mapping and scaling an image onto a torus so that it looks reasonably high quality (as the source image does).

Thanks so much!!

Valentin


May 22, 2012 | 6:37 pm

hi, please post a patch showing what you’ve tried.
thanks.


May 23, 2012 | 10:46 pm

Hi Robert,

Thanks so much for responding. I'm attaching the maxpat here. I'm using a torus as the model (about 5 mb so I can't upload here) and a fairly hi-res jpg for the texture (also about 5mb )

The main question is what is the best way to get a nice clean map on the inside of the torus (trying for a tunnel effect). I need to be able to tile/repeat the texture (or something) and have it look like the attached jpg which is what it looks like in blender using a UV map – I wouldn't mind some stretching since I can't UV map in Max (or can I?), but currently the result doesn't look at all as nice as with the blender setup.

It gets splotchy probably due to attempting to "zoom" to size the texture on the model. I think it would work better to somehow resize, but i don't know how that is done.

Let me know if this is helpful info at all, and/or if you need anything else. Thanks!

Valentin

p.s. I can send you the actual torus .obj and texture .jpg if you need to determine the problem. The image is just a large square with patterns on it.

[attachment=194617,3932]

Attachments:
  1. BlenderMapped.png

May 24, 2012 | 12:14 am

if you have it looking how you like in blender, why not simply export a collada file from blender?
this should export whatever material you are using in blender, which should have the proper texture settings and mesh uv’s.

you can load collada files in jit.gl.model, and it should very close to the blender version.


May 24, 2012 | 12:22 am

Hi Robert,

I wasn’t aware of the Collada export/import ability – I’m somewhat new to the OpenGL aspects of Max other than simple videoplane functionality. This is my first set of patches using jit.gl.model . I’m digging in a lot further now and also got Max6 and Gen today =)

Thanks for such a quick response, and I’ll look into Blender–> Collada–> Max. It sounds like that would be perfect !

Valentin


May 24, 2012 | 12:25 am

sounds good. let us know your results.


May 24, 2012 | 1:37 am

Hi,

I exported the model with UV and Texture to Collada (.dae) file. It reads into Max but although the graphic I’m using as a texture appears much cleaner now, I don’t know how to get it to "tile" or repeat. Max doesn’t seem to support the UV mapping or the repeat mode from Blender/Collada.

I also don’t know what wrap modes are supported in Max6 for texture, or how to properly message the texture to try changing to mapping to see what might work. jit.gl.model now has the texture "inside" it.


May 24, 2012 | 1:42 am

I realized it would be helpful for you to see what it currently looks like =)

nice clean display of texture where it does sit on the torus, but not tiling, or repeating – seems to be ignoring the UV from Blender.

[attachment=194629,3933]

Attachments:
  1. TunnelNotMapping.png

May 24, 2012 | 2:21 am

I’ve uploaded the .dae file and maxpat with its json file (read the .json after reading the model .dae file) to setup the position of the model and camera etc.)

So frustrating that I can’t seem to get anywhere still. Different path, but although some minor progress with texture image quality, no idea how to get a fully mapped torus that looks even about right.

I’m tryin’ – lol

Valentin

Attachments:
  1. TunnelPatch.zip

May 24, 2012 | 5:58 pm

can you also send the texture you’re using?
i can’t really test this out without it. you can compress it so it’s not so huge.

one possible issue is that certain wrap modes in opengl only work if the texture is non-rectangular (rectangle 0).
jit.gl.model *should* load the textures as non-rectangular if their dimensions are equal, and this *should* allow you to try all the wrap modes.

anyways, don’t get frustrated. learning this stuff takes time.


May 24, 2012 | 6:12 pm

Hi Robert,

Here's the texture – I'd be so happy if you're able to come up with a solution, or something close to one – lol

Thanks!

V

[attachment=194699,3940]

Attachments:
  1. WallpaperComp.jpg

May 24, 2012 | 6:47 pm

you simply need to tell the internal texture "rectangle 0" so that you can use wrap mode repeat.
it’s a little tricky.

i’ve modified your patch slightly to show you how to do this. it uses the model’s "read" notification to send a bang when the model has finished loading the file.

jit.gl.model names all it’s internal textures based on it’s @name attribute, so you want to explicitly set that to something so it’s not randomly generated each time the patch loads.

i’ve also added a jit.anim.drive object to animate the turning.

you want your qmetro to bang at a faster rate in order to get smooth animation. the drawing is synced to the window refresh rate by default, so you want the metro to bang faster than the refresh rate.

let me know if you have more questions.

– Pasted Max Patch, click to expand. –

May 24, 2012 | 7:00 pm

and here’s how you can do it with just standard jit.gl objects:

– Pasted Max Patch, click to expand. –

May 24, 2012 | 10:53 pm

Hi Robert – Right in a recording session now, but I had to check, and voila – you have responded – Thank you so so much, and I will let you know how it goes when I get a chance to check it all out later.

This is awesome !

V


May 24, 2012 | 11:03 pm

I had to check – stopped the session – PERFECT!! Thank you so much again for your time and expertise.

I’m going to hook this up using OSC from my iPhone to control it.

Back to other work – lol

Valentin


May 25, 2012 | 3:00 am

I have it hooked up to TouchOSC now, controlling the ride thru the tunnel using my iPhone now – Sooo cool.

Thanks again , Robert!

Valentin


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