Pixelshaders and Bitwise operators?

Started by
5 comments, last by Basiror 19 years, 10 months ago
hi just a question do pixelshaders support bitwise operators?
http://www.8ung.at/basiror/theironcross.html
Advertisement
Here is Microsoft''s documentation, listing all of the instructions supported by each version of pixel shaders. Just in glancing through them, I didn''t notice any bitwise operators.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
Pixel shader work, afaik, exclusively with floating point vector values (e.g., quads of floats) -- some of the newer implementations may have boolean registers for branching, I think, but you probably can''t do much else with those registers.

What you trying to do that requires the use of a bitwise op?
Shaders have 3 possible data types:

floats
bools
ints

ints are likely emulated using floats.

data can be (and is usually optimally) accessed as a vector, that is to say you can declare float2, float3, or float4 (or even float2x2, float2x3, float4x4, etc.).

bitwise operators would probably be nice, but in general most hardware would cry "mamma" if you tried to do enough branching as to require a bitfield.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

I thought about BOOLMAPPING static scenes with them

a BOOLMAP is a shadowmap indicating which pixels are shadowed and which arent

so lets say we pass the bool maps without filtering and without mipmapping then you could theoretically access the Unsigned byte values in the pixel shader via a integer and check which pixels are shadowed and which not and accordingly apply ambient light and other lighting calculations

the advantage is that you can use very highres BOOLMAPs to create smooth shadows on the geometry

you could even interpolate between the shadowed and unshadowed pixels by altering the u,v coordinates inside the shader


But this is impossible to do when those damn pixelshaders don t support bitwise operators, since all the bool values shall be encoded horizontally into unsigned byte values so your BOOL map is actually [width/8][height]

this is just theory but i think it s worth the discussion imagine how smooth static shadows one could create
no more stepping effects
you could even implement a axisaligned interpolation and a 45° rotated grid interpolation within the shader
http://www.8ung.at/basiror/theironcross.html
Integer math in the pixel shader is one of the rumored features of DX10 (along with full IEEE floating point).

Basiror,
Shadow Mapping sounds similar enough to the technique you're talking about and is certainly implementable on today hardware.

[edited by - DannerGL on June 4, 2004 5:54:09 PM]
yes i know but i thought about this feature to render my static sceens with high resolution shadows which are precalculated but require very less memory

that s why i thought about this system but good to know that they at least plan it

http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement