Render to Texture...?

manproof

New member
Trying to learn Director and am having some trouble. I am dynamically swapping image maps on my imported object. When the object is dragged onstage, it is properly mapped and looks fine. However, when I try to apply a new image from the cast as a map, the UVs appear to get messed up.

Someone in the Director forum suggested that I "render to texture" before exporting the object from Lightwave. Now, the poster stated that this option exists in other 3D applications, but he didn't know about LightWave. He also stated that it has nothing to do with the Shockwave exporter. I am guessing that he is talking about surface baking, and may be misunderstanding my problem.

Anyone know what he may mean by "render to texture?"

On a separate note, when I said I could swap textures in Director, I can but only with Lingo (Lingo is actually documented.) I want to write everything using JavaScript in Director as it is so close to ActionScript which I am already familiar with. Are there any Director/JavaScript gurus in this forum? I am not finding many in the Adobe forums :(
 
I always had to flip the image upside down to get it to work properly when trying to do this sort of thing. Something about Lightwave and Director having inverted mapping coords...
 
"Render to a Texture" is "Baking" a surface.

You bake all the different textures to a single texture that you can then apply to the obj. Director uses (I guess) obj's and allows only one texture.
 
Thank you both for the responses.

Sam_Horton:
So before I bring the images into Director I need to flip the images across the X-axis in Photoshop? You wouldn’t happen to be one of the .8% of Director users that uses JavaScript with 3D are you?

LW_Will:
I figured the person in the Director forum was referring to baking, wasn’t sure though.
 
Manproof, I find it a lot less confusing to flip the image vertically in Director although you could just do it in Photoshop.

To flip it in Director you need the copyPixels command. The java syntax and explanation is here (and probably in your Director help file):

http://livedocs.adobe.com/director/...ector_MX_2004_Documentation&file=07_met60.htm

I rather agree that the 'render to texture' comment is a red herring... I don't see how it's relevant to your problem ;-)
 
gordonbaty:

Thanks for the reply and the advice.

I was going to do it in Photoshop beforehand because I will need to be doing it for a lot of textures, and fairly frequently (162 images flipped and mapped every 3-5 sec.) I will do a test to see if this bogs my machine down :)

Wondering if you could help me out with the syntax for map swapping with JavaScript too. The thread is here (http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=268&threadid=1326640) and it includes a link to my Director file.

Thanks again.
 
well I've been using lw and director for 2 years now, and I bake everything and export to director with no problems...I don't have to flip the texture. How does this problem arises?
 
zardoz:
If you crack open the file that I have linked to in the Director forum(http://www.adobe.com/cfusion/webforu...readid=1326640) and apply the red map cast member to the model you will see that the red map gets applied differently than the blue map was originally. This also occurs if you just reapply the blue map from the cast. The coordinates are all hosed.

I will try gordonbatty's suggestion and see if that works (once I figure out how to swap the images using JavaScript :)).
 
Zardoz > LW exports the UV coordinates such that any image you apply to the W3D after export, during runtime in Director, needs to be vertically flipped. At least that's my experience.

Manproof > I had a quick look at your code and the thread on Adobe forums. I'm not familiar with the way you are accessing the texture image, and I think this may be the root of the problem. I'd suggest reading up on how Director shader and texture objects work, and how to access them (eg, something like member(castmember).model(LWmodel).shader.texture[1].image = newimage)

I personally found this aspect of shockwave3d a little bizarre - I'd recommend reading up on how the resource/model/shader/texture system works... if you search on Amazon for director 3d books you should find a couple, and they'll get you through the mechanics of shockwave3d quicker than the scraps you'll find on the web. That's my suggestion anyway...
 
Gordonbaty:

I took your advice and simply flipped my images in Photoshop prior to importing them into Director. Now I am able to swap the maps using Lingo without problem- everything lines up great :).

I am still struggling to accomplishing this with JavaScript. My code probably looks odd to you (and I am not suggesting it’s perfect) but the Syntax to do something with JavaScript is a lot different from Lingo. For example, you can’t access models the same way. Consider

member(“modelName”).modelResource[2]--Lingo
member(“modelName”).getPropRef(“modelResource”, 2);//JavaScript

I am sitting on five of the most recent Director and Shockwave books I can find and the documentation of JavaScript (relative to 3D) is really hit or miss. If you know of a book out there that covers this niche topic, let me know and I’ll order it today :). For now, I may need to use Lingo selectively in instances where I cannot figure out the correct JavaScript syntax. Not what I would prefer to do, but it may have to do for now.
 
cool, I'm glad you got everything working

I guess the javascript syntax isn't all there yet.. maybe in the next version they'll have addressed it. Supposedly an announcement about the next version of Director will be made this month
 
My fingers are crossed. I would like either the next Director to have better JavaScript implementation & documentation, or the next version of Flash to support 3D natively.

Thanks again for all of the help.
 
Back
Top