Author Topic: WIP - Crater Shader (mathematicians - to arms!)  (Read 2207 times)

Offline ProjectX

  • Member
  • *
  • Posts: 310
WIP - Crater Shader (mathematicians - to arms!)
« on: April 16, 2007, 10:19:40 AM »
Okay, I'm posting this because I'm stuck at making a crater shader that populates an entire planet with craters (and that is controllable by a distribution shader).

I suppose it would be possible to use the population controls, but that wouldn't sort out an entire planet, and so I've decided that displacement would be the best bet.

I think I have a pretty good method of choosing where to put the craters (you use a conditional scalar function on a perlin 3D scalar, and if the value is white then place a crater there) but I don't know how to actually create a crater there.

I don't know whether it's something I've forgotten about maths, but I can't for the life of me remember how to create a circular depression in terrain.

I'd love to place an actual crater shader at each of these points, but I can't work out how to mix displacement with scalars (is it even possible). Converting from displacement to a scalar (say - the Y-axis displacement becomes a scalar based on depth) would be ideal for this situation.

Anyway, if anybody can help it'd be greatfully appreciated.