jit.gl.model with jit.gl.texture - looking ugly - help?
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
hi, please post a patch showing what you've tried.
thanks.
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.
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.
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
sounds good. let us know your results.
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.
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
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.
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.
and here's how you can do it with just standard jit.gl objects:
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
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
I have it hooked up to TouchOSC now, controlling the ride thru the tunnel using my iPhone now - Sooo cool.
Thanks again , Robert!
Valentin