Pokazywanie postów oznaczonych etykietą effect. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą effect. Pokaż wszystkie posty

niedziela, 29 stycznia 2012

Fake Snowflake Shadow

Some time ago I was walking at night in a dense snow fall. I won't talk about my mood, but I was walking alone, nobody was around and I had some time to think, or rather to observe what was happening around. I was really excited about the shadows that where casted by snowflakes. They were dancing everywhere around, like small spiders running through the snow. Something beautiful, honestly. Of course, I mean shadows that are casted by something like street lamp. Now the problem is - how to simulate them? Of course we can cast each shadow accurately. But there are some obvious problems, and when I say problem I mean performance. I think I don't have to explain what problems are connected to shadowing complex particle system with multiple lights (just imagine the deferred shading with all those particles outside buffers, problems with transparency, or FR with multiple pass particle drawing, crazy). And also, there is some possibility, that you render your flakes (or even more possibly - rain) as post process. Sure! It is possible to do it in a straight way, but we wouldn't be game developers if we wouldn't look for some fakes ;) So how can we add some fancy shadows on the snow, that will look like drunk spiders? As you can expect, I'm not going to talk about any physically accurate solution. Look at the image first.




The upper part of the image is a 2D ortho projection of the world, the Source is our street lamp, green line is the ground. The lower part is meant to be the top-down view. As you can see, when the snowflake is close to the lamp (high), it's shadow is casted far from the center of the lamp cone, and it's movement dx1 is quite big. Then, when the snowflake falls and is close to the ground, it's movement dx2 decreases and position get's closer to the center. The situation shown here is utopia, because the flake falls straight down, with const speed. But, what it shows is that the shadow will be tending towards cone center with decreasing speed. This is a very important observation. Now, let's look at the right side. The snow is falling by some trajectory and in successive time periods it is located in P0, P1, P2 and P3 positions. The rule is quite the same, its shadow in time (T0-T3) tends towards cone center with decreasing speed, but we have to remember that this speed will not decrease monotonically, but will be varying. There even may be a situation, when T(n) is farther from cone center than T(n-1). When we look from top at the problem, we also have to add some variation in the other axis (due to air drag, the flake doesn't move straight), we can assume that shadow moves over some simple spline, directed towards S' (cone center) and with variably decreasing speed. The Lambda area is some small area around S', where shadows tend to dissapear (i think that making them bigger and more transparent would look good). You have to include this Lambda area if you don't want your shadows to dissapear suddenly. That's what I've observed in nature - flakes don't go towards strict cone center, but towards some area, because the light bulb isn't a point, but a volume.

Ok, I think that the idea is simple and obvious, so now - how can we simulate this? There are many possibilities, like:

  • Particle system used only for shadows
  • Post process stage shadowing
  • Animated textures (even on low-end hardware, but I won't call any exact names ;P) with texture projection
  • etc.
What you can take from this note is the general behaviour of snowflakes. Their movement is partly predictable (or at least its schema), and by reproducing it you can achieve some eye-candy scene.

piątek, 16 września 2011

With or without GPU, that is the question...

This post just represents my thoughts about how people get into some hi-tec trap. They know how to create some eye candy effects, like fish eye or chromatic aberration with GPU shader with 5 lines of code or less - that's cool. But when it comes to a situation when people don't have those shaders for their support, they get confused and say "that's impossible, you can not create such effects without modern GPU" and that's bullshit. A good example is the platform, that I'm currently working on - Wii. I can not say anything more technical about this platform due to some legal rights, but I can say (and everybody know it) that it's rather a low-end hardware. Let's get back to those effects that I've mentioned. You can create some approximation (simple fake, but that's what graphics are all about, ain't it?) using simple linear texture filtering - just create a grid of quads with regular mapping and distort their positions in some manner. With fish eye - just create radial distortion with strength proportional to distance from center of the grid. It looks quite good and is extremely cheap both in performance and implementation.Chromatic aberration - draw red channel on such grid with horizontal distortion with some strength, then green one with 2/3 of this strength and blue one with 1/3, mix them using additive blending et voila!

As a conclusion - this can be really simple, just don't ever think that something is possible only on new GPUs or CPUs or whatever, stay open-minded :) I think that this is quite what low end hardware demoscene is all about.

wtorek, 8 lutego 2011

Modelling thrown powder snow phenomenon for computer animation

This project is my Bachelor's Thesis on Warsaw University of Technology, Department of Electronics and Computer Science. The original title is "Modelowanie zjawiska wzbitego puchu śnieżnego dla potrzeb animacji komputerowej".

Abstract
The present thesis describes a fluid simulator based on nonlinear Navier-Stokes equations. The way of creating a stable solver is described. There is also some information on how to create vorticity confinement improvement. Next, the way of rendering solver output data using Blender 3D software is presented. Finally, the paper presents some examples and gives an insight into the implementation of the solver.

You can watch some effects on YouTube: [1][2][3][4][5]. I graduated with "5" mark (very good) on the 8th of february 2011.


sobota, 25 kwietnia 2009

Metaballs 2D

Just a demoscene effect, kind of presentation. But nothing big. In this small project I created dynamic metaballs (isosurfaces) and synchronized it with Drum & Bass music in the background. There were also some fancy electrical breakdowns in this demo, that occured when one metaball was close to another, and the other was then attracted by the first one. One of the metaballs was controlled by input device (mouse). And there were also some equalizers in this demo ;) Everything was created in C++ and CG (all metaball stuff is calculated on the GPU, with some simple shader).