Вопрос

I need to write a shader of pressure map. Similar to the following: Card

It is necessary to provide closed lines with borders, which shows tonality of pressure and the corresponding color gradation areas with different pressures. Maybe in future it will need to remake in 3D... Shader Language is Cg...

I have no idea where to start. I would be grateful for any advice!

Это было полезно?

Решение

What does your input data look like? Is it a texture with a pressure value at each texel? If so the coloured gradation areas should be fairly simple to achieve. Just have a look-up texture that maps pressure to colour and look up your colour in it using the pressure value at the current pixel as the UV.

Smooth, equal width contour lines are slightly trickier. You could just put black in your look-up texture at contour values but you'll get contour lines of varying width and broken lines in regions where the pressure is changing rapidly. You should be able to get fairly clean lines by using the partial derivatives from your pressure texture though, something like the technique described in this forum thread.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top