Snow collecting on ground?
Blitz3D Forums/Blitz3D Beginners Area/Snow collecting on ground?
| ||
Hi all. How can I make it so that if 1 my snow particles touch anything at all, it will "accumulate" after a while? I need an example code that will do this in real time. |
| ||
It depends on how you are doing it... 2D, 3D, Terrain? |
| ||
I'm doing it for 3D :) But a feature that allows for choosing between 3D OR a terrain would be nice ^^ |
| ||
Well, a terrain would have to be done in 3D since its a 3D object. In that case you could raise a terrain "cell" as snow lands on it. You definately won't want to leave a whole wack of sprites building up as it will run slower and slower with time unless you go single surface for the snowflakes but that gets complex. |
| ||
could u show me a small example of 1 in regular 3d w/ no terrain if possible? if not, could u show me 1 in 3d w/ terrain? that would be a GREAT help! |
| ||
I did this for Par Fore by drawing white pixels directly onto the textures. |
| ||
i still need to see a simple example. u know how i learn. no im not asking u to do it for me, im asking for an example, 2 TOTALLY different things. its not like im saying "here ya go, help me finish my project" |
| ||
The ground and the snow are two different terrains.Graphics3D 800,600,16,2 Const TERRAINTYPE = 1 Const SNOWTYPE = 2 cam = CreateCamera() PositionEntity cam,0,1,0 light = CreateLight() Type snow Field sprite End Type terrain = CreateTerrain(256) EntityColor terrain,0,255,0 EntityType terrain,TERRAINTYPE snowt = CreateTerrain(256,terrain) EntityColor snowt,255,255,255 snowheight# = .01 PositionEntity terrain,-128,0,-128 PositionEntity snowt,0,snowheight#,0 Collisions SNOWTYPE,TERRAINTYPE,2,1 While Not KeyHit(1) Cls ;create some snow For n = 1 To 5 s.snow = New snow s\sprite = CreateSprite() ScaleSprite s\sprite,.1,.1 PositionEntity s\sprite,Rnd(-128,128),50,Rnd(-128,128) EntityType s\sprite,SNOWTYPE EntityRadius s\sprite,.1 Next ;move snow down For s.snow = Each snow TranslateEntity s\sprite,0,-.2,0 If CountCollisions(s\sprite) <> 0 Then FreeEntity s\sprite Delete s snowheight# = snowheight# + .0001 EndIf Next ;here is the accumulation If snowheight# < 1 Then EntityAlpha snowt,snowheight# Else PositionEntity snowt,0,snowheight#-1,0 EndIf UpdateWorld() RenderWorld() Flip Wend |
| ||
why does the ground appear to be moving? |
| ||
also, can u make it so that the snow only collects wherever the snow hits the ground? not the WHOLE terrain? |
| ||
Could you make some proper 3d models complete with textures and animations for Rez's 'example' while you're at it. Then add some sounds and music, a menu screen, a player, some enemies with working AI, and maybe a few pickups etc if you could. Don't forget to add multiplayer support. |
| ||
BACK OFF, JA2! NO ONE asked you to talk. |
| ||
BACK OFF, JA2! NO ONE asked you to talk. I have just as much right to post in these forums as you do. I was only trying to get more of your work done for you. Oh, and I can type ALL CAPS also if you want. |
| ||
i wasn't denying your rights. I was denying you doing what you've been doing. INTERROGATING people. Don't lie, JA2, I know EXACTLY what you were doing. You weren't helping me. You were trying to attack me again. and I won't stand for it. SO BACK OFF! |
| ||
Hey there guys, calm down. @ Rez: You could do that but it would take a lot more code and be quite a bit slower. And the terrain goes up after a bit because when snow accumulates it gets higher I just did it in way fast forward so you could see it happening. I think you'll find that something like this is what you're going to want in the end. In programming, short-cuts are almost always better because if you don't take them your code runs a 2 frames per second and looks nice but is completely unplayable. In short I know it doesn't look as cool as you want it to but if you add some decent textures in, a few models, better snow, and get another tip or two from people who are more experienced than I it could look pretty good. |
| ||
i wasn't denying your rights. I was denying you doing what you've been doing. INTERROGATING people. Don't lie, JA2, I know EXACTLY what you were doing. You weren't helping me. You were trying to attack me again. and I won't stand for it. SO BACK OFF! INTERROGATING? Hmmm no I don't think so, Rez. You're very hot headed if you don't mind me saying. A bit of an internet tough guy are we? Telling people to BACK OFF just for posting on an internet forum. Tut-tut |
| ||
I'm just going to ignore you and be the adult here. unlike some people -.- |
| ||
I'm just going to ignore you and be the adult here. unlike some people -.- Yeah you said that in one of your other threads which turned into a flame war. Oh yeah, and you also said half a dozen times that you were leaving the Blitz forums. So, how did that work out? |
| ||
@What's My Face, check your e-mail & ignore anything JA2 has to say. |
| ||
There was a pretty good idea of GfK: Try to Load a Terrain from a 256x256 pix-greyscaled bmp-picture. This helps to imagine a "landscape view" Add a texture to the terrain. Something with brown and green (gras and stone) During the main loop, try to draw more and more white spots into this texture. And the end only white (but with landscape shadows) will remain. #EDIT: better demonstration code: Graphics3D 800,600 ; terrain: SnowTerrain=CreateTerrain(1024) SnowTexture=CreateTexture(256,256) ScaleEntity SnowTerrain,.3,1,.1 MoveEntity SnowTerrain,-30,0,-10 EntityTexture SnowTerrain,SnowTexture ScaleTexture SnowTexture ,4,4 TerrainShading SnowTerrain,True TerrainDetail SnowTerrain,2000,True ;camera SeedRnd MilliSecs() Camera=CreateCamera() PositionEntity camera,0,2,15 RotateEntity camera,35,0,0 CameraFogMode Camera,1 CameraFogColor Camera ,155,195,255 CameraFogRange Camera, 1,5 ;some lights light=CreateLight(1) RotateEntity light,45,45,45 MoveEntity Light, -110,44,-5 LightColor light,222,122,115 light2=CreateLight(1) RotateEntity light2,45,-45,45 MoveEntity Light2, 120,144,5 LightColor light2,115,122,255 light3=CreateLight(1) RotateEntity light3,45,0,0 MoveEntity Light3, -0,8,-5 LightColor light3,125,222,155 ; terrain gets random height-map Text 0,0,"prepairing terrain...please wait 10sec" Flip cube=CreateCube() For i=0 To 1000000 X%=Rand(1024) Y%=Rand(1024) R%=Rand(0,1) For j=0 To 2 For k=0 To 2 ModifyTerrain SnowTerrain,x+j,y+k,TerrainHeight(SnowTerrain,x,y)+0.03 Next Next ModifyTerrain SnowTerrain,x,y,TerrainHeight(SnowTerrain,x,y)+0.02 Next ; random grass and sand texture SetBuffer TextureBuffer(SnowTexture) Color 255,255,255 For i=0 To 1000 Color 50+Rand(90),50+Rand(50),0 Rect Rand(-10,255),Rand(-10,255),Rand(40),Rand(40) Next SetBuffer BackBuffer() ; snowflake on the ground Repeat SetBuffer TextureBuffer(SnowTexture) Color 255,255,255 TurnEntity camera, 0,0.1,0,True For i=0 To 10 Oval Rand(0,255),Rand(0,255),3,3 Next SetBuffer BackBuffer() UpdateWorld RenderWorld Flip 1 ;WaitKey Forever |
| ||
Hi Rez, please have a look on the code above . I did edit it and now it looks really nice. It shows, how to paint the snow on the ground. You can combine it with the falling snowflakes from "Whats my face" |
| ||
thanks midimaster :) |
| ||
It still needs some work, but |
| ||
is there any way you could make it so that the snow falls onto a colored object, and make the snow accumulate until its a big, packed snowball packed into one on the ground? |
| ||
what do you mean with "snowball"? A really snowball? I would add an white sphere, which is very small at first and then growth... |
| ||
i didnt actually MEAN snowball. i mean make it accumulate on different objects and build it up so it looks LIKE a snowball. |
| ||
You seem to be barking a lot of orders at him. Maybe you should try coding it yourself first. If you code it, you know exactly what you want. Also, people won't take you as an idiot for constantly demanding people to code things for you. |
| ||
One way to simulate it would be to have a mesh that represents accumulated snow for each object. Then as snow "accumulates", you scale the object on top of the original object. For example you could have a roof and then position a copy of the roof slightly higher than than the original, then scale the copy, textured white of course. |
| ||
Why even bother to help Rez anymore? He clearly doesn't appreciate anyone's help and he gets upset and rather obnoxious as soon as he doesn't get things the way he wants. He comes across as a rude, impatient, and disrespectful teen age brat. |
| ||
@JA2: this is a board free to help anybody. Everybody can decide on his own whether to help or not! And as you can see, not only Rez is interested in this theme. He only introduced the problem, and I am happy to discuss solutions with other people. @Rez: be patient and respectful with all members, even those, who can or want not to help you. @all: please stop those discussions (flames) about non-topic related aspects. Use a smalltalk forum for this! |
| ||
this is a board free to help anybody. Everybody can decide on his own whether to help or not! And as you can see, not only Rez is interested in this theme. He only introduced the problem, and I am happy to discuss solutions with other people. I am not demanding that you stop helping him or others, I just wonder if it's worth all the abuse that Rez dishes out when he's finished with your help. |
| ||
[Edited] |
| ||
Here http://www.filefactory.com/file/a1g6f22/n/snow.rar I tried to get it to look like snow was accumulating but melting as it hit the ground. |
| ||
WOH! that is COOL! Thanks! :) So how can it accumulate on objects, and not the ground? |
| ||
is there any way u could make the snow stop melting, and "stick" to the object? |
| ||
so you have to combine "whatMyFace" and "Gfk" ideas. |
| ||
ok. so i figured out how to get snow to stick. what i DONT know is if it can stick to objects. also theres a glitch in it where it slows down the frame rate, can someone help me fix that? also, when it sticks to the ground, i need for it if a snowflake touches another snowflake WHEN sticking to the object, the snowflake sticks to the other snowflake, and depending on how many snowflakes are on the ground, it raises the snow level accordingly. code: |
| ||
Tbh, i don't think there is a fast way of doing what your proposing. Going down to snowflake level, your totally overdoing the effect. Programming games, is all about approximations in my experience. Trying to dabble with snowflakes and getting to know if they are colliding, is going to KILL your framerate. |
| ||
i think they already stick to each other. i cant really tell. as for frame rate, i DO know about that. what i want is be able to take the texture of the snow ground and manipulate it by raising its height in the areas ONLY where more snow falls. |
| ||
so yea. is there anyway to manipulate it? if so, how can i? |
| ||
Rez, there is no need to work exact with the snowflakes. It doesnt matter, whether or when they reach the ground. Neither, if they collide anything. Because also in reality they are too much, that a person can watch a single one. Important is only... 1. ...the dancing of a lot of flakes and I think SPRITES are the right way for that. More important is the chaotic dancing of them, but with a little "wind". 2. ...the white spottings on everything (horizontal only?), caused by the snow. everything changes to white, but with a long time of green (grass is higher then earth) areas between the spots. Also the trees need a lot more time to be white. Do this with paining direct to the Textures 3. the forming of landscape, if a lot of snow falls. The snow imitated the form of all meshes, but with less "roughness", so after a while everything seem to be "round". 4. all the effects need a lot of time, and normally the watching person does not recognize this development. In animated films they often work with a "before" and "after" landscape, with a heavy snowstorm between both states. |
| ||
i repeat my question.. that doesn't tell me much, no offense. |
| ||
Why? Because he didn't have any example code for you? |
| ||
keep smarting off, ked. u jerk. -.- im just going to ignore EVERYONE who treats me unfairly just because i have ADD & a learning problem. IM SO SICK OF U PPL TREATING ME LIKE THIS! im done w/ ALL of u! |
| ||
keep smarting off, ked. u jerk. -.- im just going to ignore EVERYONE who treats me unfairly just because i have ADD & a learning problem. IM SO SICK OF U PPL TREATING ME LIKE THIS! im done w/ ALL of u! Again, Rez? Hahahaha |
| ||
im not even going to comment anymore to ANY of u. ESPECIALLY U, JA2, U IDIOT. I hope u get what u deserve one day, and someone hacks u, and u lose ur ENTIRE LIFE! B/c that's how I feel the way ur treating me now. so im done w/ BOTH of u fags! ban me! im sick of the way u all treat me! :@ |
| ||
I come up to the B3D forums solely for these threads, they crack me up. |
| ||
im not even going to comment anymore to ANY of u. ESPECIALLY U, JA2, U IDIOT. I hope u get what u deserve one day, and someone hacks u, and u lose ur ENTIRE LIFE! B/c that's how I feel the way ur treating me now. so im done w/ BOTH of u fags! ban me! im sick of the way u all treat me! :@ Awesome, keep 'em coming, Rez! |
| ||
@Ked and Ja2 sure, REZ has seldom good answers, cannot help others. But his questions are interesting, sometimes excellent!! (look at http://www.blitzbasic.com/Community/posts.php?topic=88105) So why not let ask him??? @Rez keep calm, not everybody must be your friend. But be careful, that they do not exclude you from this forum. "idiot" is not the way we discuss here!!! The plan you have, is a too big one. I think, snow at the objects means to have a second mesh of every object, that is a little bit smaller than the original. And slowly if becomes bigger in y-axe, so it gets visible on all horizontal parts of the object. But at the same time the form of the snow-object has to become smoother and smoother (sorry for my english) This is not the project of a beginner, sorry. This is not even the project, a good coder could do by his own. Try to find a "team". |
| ||
Midimaster, you will learn :) How many times are you going to break the forum rules here DSW/Rez? Fag is worse than an idiot. You don't belong on here if you use that language and persist with that attitude. Personally, i no longer help you, because i don't like your attitude, or the way you treat other members. Your not entitled to this free help other members provide. You'll soon have no-one left, to help you... I hope u get what u deserve one day, and someone hacks u, and u lose ur ENTIRE LIFE! B/c that's how I feel the way ur treating me now. so im done w/ BOTH of u fags! ban me! im sick of the way u all treat me! :@ So, let me get this straight. You hope someone loses everything they own and have worked for, because... you didn't get the nessesary help you >required< on a forum? Get a grip man. Seriously... |
| ||
Here is my try at this : http://blitzbasic.com/codearcs/codearcs.php?code=3093 |
| ||
Nice job, RemiD - You've taken a straightforward approach and it's effective yet still (relatively) simple :) |
| ||
Very cool(cold) indeed, I'm dreaming of a white X-mas.. |