Loading...
  OR  Zero-K Name:    Password:   

New rocket plume rendering model - Xmas came early in 2022

11 posts, 579 views
Post comment
Filter:    Player:  
sort
I was like thinking(tm), and it came to me this. All rockets make exhaust, and its a lot of cpu thinking on how to make it look pwety, and it still sucks. It looks 2003. So i was like thinking. Lets GPU handle rockets and smoke. And before youll jump to navier stokes and such, what if each physics frame we would draw new lines where smoke is made from last physics frame, and then blur and swirl them per each physics frame. I would see it as this:

After frame is rendered and smoke bitmap is rendered.

Smoke bitmap contains UV velocity data per pixel and pressure, and pixel color.
color[] float3
UVvel[] float3


there is a tillable noise texture made in blender with lots of swirls(distortion option),
and theres a normal map made out of it for bump.

swirls[] float3


The pitch consists of the main two buffers are sized third of monitor resolution, and it spans 3x the draw area.
( so effectively its same sized as screen, but main is viewable in middle square of 3x3.

Once the smoke happens from previous location, the line is drawn on UVvel, with UV velocity of 0 and pressure of set pressure, using width of line as needed per camera zoom, so its simple glline on texture using (u,v,pressure) as colors, with UV set as opposite of where the rocket is headed

Smoke is calculated per physics frame.

- theres application of swirls.
  swirlpos = mix ( UVvel[].uv ; throw (UVvel[].uv at direction of swirls[].yx with same lenght) ; using pressure )
  swirled_UVvel[] = UVvel[ pos + swirlpos ]
  swirled_color[] = color[ pos + swirlpos ]


less pressure, more swirl aligned it becomes. same for color[]
yes, yx so its perpendicular to bump slope
what happens here is we use existing swirls in the swirl texture
and throw the speed vector at perpendicular to slope of the swirl from bumpmap.

- blur_UVvel[], blur_color[], vector3 is made (half the size of the pitch)
using gpu default blurring for mipmaps so its quick af.

additionally there need to be adjustments to uv depending on pressure

  posN = pos+[ 0, 1]*epsylon;  xN = blur_UVvel[ posN ]
  posS = pos+[ 0,-1]*epsylon;  xS = blur_UVvel[ posS ]
  posW = pos+[ 1, 0]*epsylon;  xW = blur_UVvel[ posW ]
  posE = pos+[-1, 0]*epsylon;  xE = blur_UVvel[ posE ]

  pressures = ( posN*(1+xN.pressure) + posS*(1+xS.pressure) + posW*(1+xW.pressure) + posE*(1+xE.pressure) )
  
  blur_UVvel[].uv = mix ( 
     blur_UVvel[].uv ; 
     pressures / ( xN.pressure + xS.pressure + xW.pressure + xE.pressure + 4) ; 
     blur_UVvel[].pressure )


so it alters the direction, basing on the where the pressure is highest,
using pressure to figure out how strong the alteration is need to be made.
+4 because to avoid div/0

- next is calculated using:
  mixer = swirled_UVvel[ swirled_UVVel[].uv ].pressure + entropy
  UVvel[] = mix( swirled_UVvel[] ; blur_UVvel[] ; mixer ) 
  color[] = mix( swirled_color[] ; blur_color[] ; mixer ) 


- and viewport adjustments for perspective and moving it around, so UVvel and color move and scale using simple scale and transform.

higher pressure, the more towards blur it goes.
entropy is constant to keep it going toward blur if there is no pressure, or uv next to a freshly drawn line.
thats why its needed to be done at physics frame

so yeah. its not navier stokes, but. it does its job, at cost of 5 texture lookups and 2x mipmaped blured textures.

as a bonus, you can add pressure eminating points with no color modifications where units are standing per each frame of physics, so you would have the effect of units walking through smoke. and smoke swirling around them.

and you can also use maps wind direction

so, at the end you have a smoke texture, that doesnt need constant calculations of ugly 3d lines, but it creates constant smoke effect that accumulates and swirls and dissipates

prolly some improvements need to be done like if blurred UVvel to 1/16 of UVvel shows no action then drop whole procedure in quadrant, but still it might be cool smoke

:)

i would so code it self but have other stuff to do rn.
+0 / -0
2 years ago
quote:
additionally there need to be adjustments to uv depending on pressure

posN
pos+[ 0, 1]*epsylon; xN
blur_UVvel[ posN ]
posS
pos+[ 0,-1]*epsylon; xS
blur_UVvel[ posS ]
posW
pos+[ 1, 0]*epsylon; xW
blur_UVvel[ posW ]
posE
pos+[-1, 0]*epsylon; xE
blur_UVvel[ posE ]

posN = pos+[ 0, 1]*epsylon; xN = blur_UVvel[ posN ]
posS = pos+[ 0,-1]*epsylon; xS = blur_UVvel[ posS ]
posW = pos+[ 1, 0]*epsylon; xW = blur_UVvel[ posW ]
posE = pos+[-1, 0]*epsylon; xE = blur_UVvel[ posE ]


FIFY.
+0 / -0
2 years ago
daumn... instant crickets... though we would have code discussion...
+0 / -0
chaplol
2 years ago
Post some gifs!
+2 / -0
quote:
daumn... instant crickets... though we would have code discussion...

1) There is no actual code to discuss
2) The writeup is fairly confusing
3) Granted 1 and 2, figuring out whether the proposal would actually work is tedious and laborious
4) Skimming it, it reads like you're trying to do 2d operations in a 3d world (smoke diffusion and turbulence "after rendering bitmap")
5) Granted, 1-4 it is both tedious to figure out what the hell it means and probably would be wasted effort

quote:
Post some gifs!
+0 / -0
yeah. exactly it does 2d smoke in 3d world, a screen space smoke. it does basically draw new line of smoke, blurs it, and then applies swirls, on 2d level. since smoke is something noone really gives shit about, but would be cool if it would work., and zk is a 2d game. minus some hills, but when youll have smoke on the hill, it gets painted larger, so 3d illusion applies there too...

quote:
Post some gifs!

dude. i totally would, but im invested in something else rn.
+0 / -0
quote:
yeah. exactly it does 2d smoke in 3d world, a screen space smoke. it does basically draw new line of smoke, blurs it, and then applies swirls, on 2d level. since smoke is something noone really gives shit about, but would be cool if it would work., and zk is a 2d game. minus some hills, but when youll have smoke on the hill, it gets painted larger, so 3d illusion applies there too...

This would have worked for OTA with its locked isometric camera. I don't think it's gonna work for a a tiltable, rotatable, zoomable, perspective camera.

I'd feel happy to be proven wrong, whenever you untangle yourself from your other investments.
+0 / -0
chaplol
quote:
dude. i totally would, but im invested in something else rn.


(I feel ya, just don't forget that reading others' code can take a lot of personal energy, especially if your audience is themselves invested in something else ;). Finding ways to lower the energy cost for others (eg, visualizations!) is helpful because it builds context (or narrative, or expectation, pick your poison) at a relatively low energy cost.

Made the same mistake just this Monday at work by posting a bunch of data analysis with minimal context to help build a mental picture to understand the underlying context -- the stuff that my audience is normally used to. So even though the analysis was compelling to *me*, just on its own, it was like sifting through mud for them. And now my week has been working on the "fluff" stuff.. RIP.

It sucks, but them's the bends.)
+0 / -0
the rendering takes that camera in account by looking only in centre of 3x3 space

The camera is looking only at the centre piece with one screen up,down,left,right buffers to do camera movement and zoom outs. Extra smoke around being rendered only for that event of camera moving or rotating. (the bitmap can be rotated, and streched to match rotation and camera angle)

chaplol ikr, thats why im fucking off offgrid as soon as i will get some $ to get 5k land, hoophouse and wind turbine. the bruises youll get when proving shit to idiots are only your own... im vegan, i can do small tech to support, there are some bullshit jobs like warehouse office worker at seller online shit. but longterm i was thinking on seelling luffah sponges for spa people... should be enough for taxes, and internet and some puter parts or motocross parts and fuel...

[Spoiler]

but that said i also know how to make kickass aerospace designs, so idk. i might do some vegan equiv of cesna citation x that im gearing torwars... but mine will have vtol and water landing... for 200k$ while private jets go 10m$.



+0 / -0
chaplol
2 years ago
Live your life in a never-landing ultralight and feed off the birds, friend.
+1 / -0
actually a sailboat would do better and some guide to wild plants and uninhabited islands.... but yea. you go in right direction, tho im vegan, i dont do living out of anyone but plants
+1 / -0