How tile anim strip image on a mesh?
Blitz3D Forums/Blitz3D Programming/How tile anim strip image on a mesh?
| ||
Hello. I have this problem.... I.E. How can obtain a tiled strip image texture on a mesh (i want animate it after...). I use a strip image for example to animate water i assign it to a plane but i can't tile it. Please explain me if possible :-) try this..... (media is a strip image of 256x64 pixels) Graphics3D 800,600 Global scale# = 1 camera = CreateCamera() cube = CreateCube() texture = LoadAnimTexture("tp.jpg",49,64,64,0,3) ;texture = LoadTexture("tp.jpg") EntityTexture cube,texture MoveEntity camera,0,5,0 RotateEntity camera,90,0,0 While Not KeyDown(1) If KeyHit(205) Then scale = scale+ 0.01 ScaleTexture texture,scale,scale EndIf If KeyHit(203) Then scale = scale- 0.01 ScaleTexture texture,scale,scale EndIf TurnEntity cube,0,1,1 RenderWorld() Flip Wend Ok gfk! but i sayd that i want apply a imagestrip texture if you see 'my code' it use loadanimtexture not loadtexture. try this code and you will see what i say.... after i want say that i already try thi code because it is the first thing that i wrote (obviosly). i have changed the code for use plane into cube because i can see what happen in manner mode. many thanks however |
| ||
If you mean you've applied a texture to a plane but want the texture to be repeated, you can do so using ScaleTexture. As for what values to use, the best way is to experiment until you get the 'look' that you want. |
| ||
I mean this but scaletexture don't work. I try several value but nothing? ohw i ca do.however thanks GFK |
| ||
This code works:Graphics3D 800,600 Global scale# = 1 camera = CreateCamera() plane = CreatePlane() texture = LoadTexture("monk1.jpg") EntityTexture plane,texture MoveEntity camera,0,5,0 RotateEntity camera,90,0,0 While Not KeyDown(1) scale = scale + 0.01 ScaleTexture texture,scale,scale TurnEntity plane,0,1,0 RenderWorld() Flip Wend |
| ||
..in some cases, 3DS and B3D files somehow dont allow you to use scaletexture, so after I apply UV map modifier and then collapse as a mesh, things use to be fine...this is of course my issue with 3dsMAX.. |
| ||
Give me a solution!!! |
| ||
pfft |
| ||
Give me a solution!!! I already did. You said you wanted to create a plane, apply a texture and make the texture tile/repeat. That's precisely what the code above does.Now, I'm wondering why you've edited my code then amended your first post to include it. I'm clearly not barking up the wrong tree here... |
| ||
Please read carefully my question. I need a solution. |
| ||
ok, in case you using plane in order to simulate water, before you export it, apply on it PLANAR UV map, and then export it..after that in Blitz use usual way to tile it (Scaletexture).. |
| ||
@ vivaigiochi You've got a titling solution there so all you need is to include some timing routine to animate. Something like this in conjunction with what you have should work.. global MyTimer = millisecs() global Frame = 0 while not keydown(1) ;do other stuff if ( millisecs() - MyTimer ) > 100 ;change this value frame = ( frame + 1 ) mod 4 entitytexture cube, texture, frame MyTimer = millisecs() endif wend This will change the texture 10 frames a second. Stevie |
| ||
If you want to tile a texture then you need to scale it by an appropriate amount: scaletexture texture,0.5,0.5 ;this will tile it such that the texture appears twice in both directions (u,v) on mesh. scaletexture texture,0.25,0.25 ;this will tile is such that the texture appears 4 times in both directions (u,v) on mesh. scaletexture texture,0.125,0.125 ;8 times and so on.. If you want it to repeat 2 times then you would need to scale by 1.0/2.0 (ie 0.5), if you want it to repeat 4 times then 1.0/4.0 (ie 0.25) If you want it to repeat 256 times, as an example, then you will need to scale it by 1.0/256.0 |
| ||
Ok many thanks to all, but i have just tried all solution posted of you and the result is NOTHING!! Please give me a solution! if possible send me an email with a model to try it. I remember you if i use a standard image all solution proposed of you is ok! but if i use a strip image no! |
| ||
Show us the code you have so far and, if you can, upload your image strip so that we can use that to demonstrate. Stevie |
| ||
Ok Steve G (and others) but i obtain same result with all image strip. I.E. I can upload it but if you use the code above with an image strip created of you (media is a strip image of 256x64 pixels) you can see the results. However how can i upload this image to you? Thanks |
| ||
e-mail the image to me stevieATsteviegoodwin.plus.com together with the code you're using and I will get it working for you. Stevie |
| ||
Steve please may you write a correct email address? thanks :-) |
| ||
Replace the AT with @. E-mail address is in my profile too. I won't be able to do anything until I get back from work ... in about 6-7 hours. Cheers Stevie |
| ||
SUCH A BUG - NO UPPS THUMBS THERE: Graphics3D 680,480,16,2 Global scale# = 1 camera = CreateCamera() cube = CreateCube() texture = LoadAnimTexture("1mage1.png",148,128,64,0,6) EntityTexture cube,texture While Not KeyDown(1) TurnEntity cube,0,1,1 RenderWorld() Flip Wend Global MyTimer = MilliSecs() Global Frame = 0 While Not KeyDown(1) ;do other stuff If ( MilliSecs() - MyTimer ) > 100 ;change this value frame = ( frame + 1 ) Mod 2 EntityTexture cube, texture, frame MyTimer = MilliSecs() EndIf Wend End/Memory access violation TV Hz |