PDA

View Full Version : How can you assign a material on a pex pixel basis.

bloodbob
04-Jun-2004, 07:55
Reading an interview on stalker I noticed this ( http://www.beyond3d.com/forum/viewtopic.php?t=12891 )

Natural render of complex materials with proper light interaction, such as rusted metal, natural flora, glass, skin, and so on. In addition, every pixel (not texel) can have its own material with several coefficients.

The only way I can think of doing this is either to tesselate everything so that the triangles are no bigger then a pixel. Or to pixel shaders with basicly a case statement which calculates the screen space does a look up on an array ( texture ) with which material to apply to that pixel which you couldn't do on PS2.0 ( without 50 passes or so ) and would still die on ps3.0.

Does anyone have any other clue on how this could be done?

Simon F
04-Jun-2004, 08:07
Much easier - you have a texture that determines the material type, say 0=>shiny metal, 1=>corroded metal (or wood or grass), and use that to interpolate between two material calculations.

Extensions are left as an exercise to the reader.

bloodbob
04-Jun-2004, 08:16
Much easier - you have a texture that determines the material type, say 0=>shiny metal, 1=>corroded metal (or wood or grass), and use that to interpolate between two material calculations.

Extensions are left as an exercise to the reader.

The look up is then on a per texel basis which they explictly state is not the case. Well per 4 texels. Anyway that still doesn't help with an execisvely long shader.

Simon F
04-Jun-2004, 08:57
Much easier - you have a texture that determines the material type, say 0=>shiny metal, 1=>corroded metal (or wood or grass), and use that to interpolate between two material calculations.

Extensions are left as an exercise to the reader.

The look up is then on a per texel basis which they explictly state is not the case.
What they say and what they mean are probably different things.

Have a think what it would actually mean to have the material change per screen pixel as opposed to something locked to the surfaces of objects. It'd be chaotic.

Oh! I wonder if they are trying to do some of the effects that modifier volumes in CLX2 (DC) could provide? That could choose between 2 different materials on a pixel by pixel basis depending on whether an object was inside or outside volumes &lt;shrug>

DeanoC
04-Jun-2004, 09:37
You could just use a deferred lighting system with a stencil modifier volume.

Render the scene with screen per-pixel material (though presumebly comeing from a per-texel or per-vertex material channel).

Then render a stencil volume ala shadow system, then change the material index inside the volume (you would need to organise your material so a simple add changed them in the same mannor, i.e. +100 makes things old and rusted).

Then do the lighting calcs, I had a demo which mixed realistic and a basic toon shader in this manner...

Chalnoth
05-Jun-2004, 17:56
The look up is then on a per texel basis which they explictly state is not the case. Well per 4 texels. Anyway that still doesn't help with an execisvely long shader.
Well, you can obviously interpolate between texels to get a unique number per-texel.