Switching textures in shockwave

gordonbaty

New member
I've got a question about textures in Shockwave, and how it relates to W3Ds made in Lightwave:

I want to use 1 model with 3 or 4 textures, whereby the user can choose one of the textures to give it a different 'look'. So what's the best way to do this with LW?

Ideally, I would create a W3D containing the model plus multiple UV maps using Lightwave? Or do you have to create one W3D per UV map and use those to create the textures in Director? Anyone know?

As always, I really appreciate the great advice from you kind chaps.

Gordon
 

mdoyle

New member
The best way to do it would be to create one w3d with one uv map. Export that. Once in director you will want to swap the image that it uses with the another one. The only problem you ahve is that director will flip your uv's in some way or another so the images which you want to swap with will have to flipped on some axis or mirrored first if that makes sense
 

MentalFish

LScript minion
I have thrown something together that demonstrates two different ways of changing textures dynamically. The most gfx card friendly is to just replace the pixels of the same texture, instead of creating a new texture in memory for each texture that is going to be used. If you are going to use all textures on various models at the same time (all on screen), you have to have all textures loaded/created ofcourse.
 

mdoyle

New member
It is more gfx card friendly but u get a delay and can have alot slower frame rate. Its because you are swapping between system memory and gxf card memory. If u looked at the stress test thing I put up before it demonstrated that. There are obvious pros and cons to them both, but for things like an animated texture or screen you are better to load them wherease if it was just changing a texture once or twice then perhaps the other way. It all comes down to what spec of pc you are aiming for and the size of textures you want to put in the card
 

MentalFish

LScript minion
Hmmm, I think you are right, but at the same time, last time I tried the texture replacement script for an animated explosion, I didnt have any noticable lag on my PIII 900 MHz with 256 MB ram and 32 MB geforce MX card (30 frames of explosion)... which i find surprising. I got a slowdown from the amount of asteroids but nothing that I could see, or remember, when the explosion is triggered (either by shooting an asteroid or crashing into one).

An issue I have seen is when you try to dynamically delete and create a new texture for each frame of animation, that creates alot of processing time, but just replacing the image of the texture seems to be rather speedy.

member("3DWorld").texture("anim").image = member("frame10").image

Perhaps you guys can give it a go:
http://petter.ms/forum/space_scene.htm

Shift to accelerate
Ctrl to shoot
Arrow keys to steer (its all a bit tricky :bangwall:)

If your ShockWave plugin is set to obey content settings or atleast manually set to DX 5.2, then you will see some nice glow effects that utilize a DX bug for that additive effect :)
 

mdoyle

New member
I agree but I have never did the deleteing the texture and adding a new one. The replacing a texture lag only seems to happen if you have a lot going on and you are starting to eat alot of memory. Its just a matter of choosing when to use it or not.

I like your game. You are right it is quite hard!!! =P The lense flare textures are quite nicely done on the engines. I noticed that you are getting your texture pinch at the top and botttom of the sphere of the space bkg. I dunno if u have tried this, but for me to get rid of it (I did this for a sky for an outside scene) Was to create a sky the way you like in whatever format in lightwave without the pinching, then baked the texutre to a cube. If the luminosity/emmissive is up at white in shockwave then u don't see the seems but u get what seems to be a perfect sky.

Here is an example but there is no bottom but all u would need is a white plane. The textures are a bit high but its just a wee example.

Cheers

M
 

MentalFish

LScript minion
I am using a skysphere instead of a skybox, by doing that I can tile the star texture (512x512) instead of baking out 6 x 1024 textures for one sky box. The most quick and easy way to remove the pinching in the nebulae texture is to add some more black along the areas (top and bottom of texture) where the pinching occurs. I am thinking about adding some nebulae polygon planes, and adding some random positions to them, say 5 to 6 planes, pointing towards the camera.
 

mdoyle

New member
The textures on that scene where only 5 x 128 textures but they can be reduced, but most of the time I have the luxury of being able to use alot of textures as my minimum spce for my projects are the 1ghz, 64 meg card and 128 meg of ram. Because we are creating a system check tool some of the projects will have varying levels of texture detail, characters, meshes as well as have a distance level of detail so anything up close is as high detail as possible and with good pcs u can have quite good looking scenes as well as the shadows on a 2nd texture layer.
 

MentalFish

LScript minion
I dont think you would be able to recreate any stars at 128 x 128 resolution on each side of the cube, but perhaps using a skysphere for the stars, and add a skybox, as you have suggested, for a lower resolution of a continous nebulae inside of that with transparency so the stars shine through could be doable. Ill see what I'll be doing, I am using Poetry In Motion at the moment and can easily add several texture layers with different UV coordinates, and as such I have created a skysphere with one UV for the stars, and one for the nebulae and the nebulae is set to be additive on top of the stars, works nicely. The skysphere in that demo is only using one UV and therefor the only way to avoid pinching will be your suggestion or as I suggested to add some more black to the top and bottom of it.

Something that would be cool to do in Lingo, is to create the nebulae dynamically by imaging lingo, mixing and colouring a set of textures into one image and apply it to the scene. Various areas in space have different types of nebulaes, some are blue, some more red and so on... That would save alot of stored graphics, and make the game fast to download... hmmm...

Oh oh oh, check this out, it is eternally cool, using Flash as an interactive texture (think about the possibilities in terms of GUI making):

http://earthwormjim.free.fr/flashcube/
Right cllick to rotate the cube, left click to "access" the Flash

I have made a colour slider thing in Flash once, you can try to paste that one in there:
http://petter.ms/ruf/ruf.swf

Here is an explanation in French:
http://earthwormjim.free.fr/director/tutoriaux/3d_flash_mapping/index.html

Its really cool!!! :thumbsup:
 

mdoyle

New member
Nice idea for the flash cube but as a gui it would need to well thought out for usability. Thanks for the links!!! :D


Sounds like a good idea for the space would be interested to see your results. YOu might get away with some stars as non moving partices but it could be a hit on performance.

We did both a colour chooser in flash and director. One of them was to pick the colour of a car rather than having to swap textures. We bascially had the base model a colour and used a 2nd texture layer multiplied over it to give the detail. It allowed the players to have any colour they wanted without having to create multiple textures.

For your different uvs, can you actually have one object and use another objects uv from it?? We have been trying to create that but are running into problems. For things like shadows etc we can use the scaled version of the texture so you have it tiled and one with the shadowed uv'd. The is very tedious to creeate especially if you want a while scene built with not polys sharing the same uv space. Is there a way you know that you might be able to either take another w3d's or obj's uv and use its uv co-ordinates (as long as the same amount of points) to apply a 2nd texture? The results we have so far a pretty bad as the exporter doesn't seem to export the points in the same space or order every time.
 

MentalFish

LScript minion
Well, I wasnt thinking of a Flash cube necessarily, but rather using Flash to create all GUI/HUD elements instead of doing the manual texture swapping of selfdefined overlays and such, inside of Director. I just find it way easier to create 2D GUI's in Flash.

The multiple UV was in Poetry In Motion, not Director, but yes it is possible with multiple UV's by either making an OBJ parser or comparing two W3D models with eachother, and make a UV transfer script that base its copying of UV's from one model to the other by comparing the position of the vertecies. You have to make some tolerance snap values in the script too. While other have, I havent made such a script yet myself, and I haven't decided if I am going to either (beacuse of Poetry In Motion supporting it natively).

Want to make a collaborative project? Lets see if we can come up with a UV copy script between 2 identical models but with different UV's...?
 

mdoyle

New member
Is poetry in motion an engine? Do u have a link to it so I can have a look at it?

We did have a mess about with an obj parser before that kind of work and managed to get uv co-rodinates but we couldn't get them matching up as I said before. We never had tolerance snap values so that might be the answer we were looking for. I will see if I can find the file as it was a while ago and it was done in a morning and it was a bit messy code just really a quick research thing but we hit a brick wall so it was put by for a while. Hopefully will still have it sitting somewhere :D I would be interested in trying to create a script that can do this and if it could be between w3d's rather than obj's that would be even better. It could make shadowing a w3d world so much faster without having to be so careful with uv mapping and scaling etc.

Let me know how you would like to go about this

M
 

mdoyle

New member
Was also thinking do you think if it worked there could be a way to actualmorphs? With the parser we tried to create morph targets to do things like eye animations or other shape changes but thats when we realised that either obj's or w3d's don't have points created in the exact same order once save from lightwave which gave horrible results for morphs. It could be another possibility that would save bone animations. Whether it would be a bigger hit on performance or not I am not but the possibilities of character animations etc would be great in shockwave

Here is a character I had created recently for shockwave with animations, but eye morphs could help a geat deal. I did have eyes animating with eyelids but because some graphics cards have horrible clipping results with close together objects then the characters with eyes and eyelids looked scary as the model sometimes flickered through. Just unrar and run the exe. Its a previewer we made to test character animations. Just save the base model with textures in the top level, and the animtions in the layer underneath. It provides buttons to swap between
 
Last edited:

MentalFish

LScript minion
mdoyle said:
Is poetry in motion an engine? Do u have a link to it so I can have a look at it?

Yes sr, it suuure is:

http://forums.cgsociety.org/showthread.php?p=3278934

ftp://ftp.newtek.com/multimedia/movies/Pim/pimdemo.avi

Its javascript based (JS1.5), so no class based object orientation yet, but still very capable. Its going to be the best thing that happens in 2006 :)

PIM even has its own multiplayer engine, and it is way simpler to set up than ShockWave Multiuser Server!
 

mdoyle

New member
Am in the process of reading that cg talk thread. Went right back to the start. Can it really do all that director does? I mean we need to write to scorm compliant data bases and used in lms's etc I would need it to basically do everything tat director does.

Still reading so maybe find the answers out soon.

Wots your thoughts on creating that uv script still?
 

MentalFish

LScript minion
I am still up for the UV script :)

PIM does not do everything that Director does, yet, but it will. With the developer Enki the situation is like this: "Enki, have you seen the multiuser server technology that Director comes with?", a few weeks later i get a virtual poke on the shoulder, "PIM has built in multiuser server now", I spend a few minutes on it and have a multiuser test up and running... its crazy :)

I am keeping a paralell use of Director and PIM for still some time, as I think these are the most viable solutions in the time to come. Adobe owning Macromedia now will most likely give us an up to date Director, while PIM will provide all the cutting edge visuals and 3D engine today with more traditional features coming over time.
 
Top Bottom