|
|
Up |
|
|
  |
Author: Noley EdgeNoley Edge Date: Jun 6, 2008 00:26
Using a vertex shader, is it possible to send out the z value of
vertices to a pixel shader which then displays the values as a color,
even if the scene has fixed function fog?
Currently I am doing the above to produce a position texture, which I
then use as the basis for a Z position map. When fog is off,
everything behaves as expected. Objects which are close to the camera
are one color, and those farther away interpolate to another.
However, as soon as I enable the fog renderstate, the values are no
longer accurate.
I have read that pixel fog cannot be used with vertex shaders, however
I get this result just by enabling fixed function fog. I then tested
specifically for vertex and pixel fog, and both produced whacky
results.
Any insight is appreciated. Thanks in advance.
|
| |
|
| | 6 Comments |
|
  |
Date: Jun 6, 2008 15:40
[Please do not mail me a copy of your followup]
Noley Edge gmail.com> spake the secret code
<4feae760-66fc-4d8b-b770-05e608c6bc27@d45g2000hsc.googlegroups.com> thusly:
>Using a vertex shader, is it possible to send out the z value of
>vertices to a pixel shader which then displays the values as a color,
>even if the scene has fixed function fog?
There are two kinds of fixed function fog: vertex fog and pixel fog.
If you use a vertex shader, you can't use fixed-function vertex fog
(you have to compute the per-vertex fog factor in your shader).
IIRC, fixed-function pixel fog can be used with a vertex shader,
providing you're not also using a pixel shader.
|
| |
|
| | no comments |
|
  |
Author: Noley EdgeNoley Edge Date: Jun 10, 2008 11:50
On Jun 6, 6:40 pm, legalize+jee...@ mail.xmission.com (Richard
[Microsoft Direct3D MVP]) wrote:
> [Please do not mail me a copy of your followup]
>
> Noley Edge gmail.com> spake the secret code
> <4feae760-66fc-4d8b-b770-05e608c6b...@d45g2000hsc.googlegroups.com> thusly:
>
>>Using a vertex shader, is it possible to send out the z value of
>>vertices to a pixel shader which then displays the values as a color,
>>even if the scene has fixed function fog?
>
> There are two kinds of fixed function fog: vertex fog and pixel fog.
> If you use a vertex shader, you can't use fixed-function vertex fog
> (you have to compute the per-vertex fog factor in your shader).
>
> IIRC, fixed-function pixel fog can be used with a vertex shader,
> providing you're not also using a pixel shader.
> --
> "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
> < http://www.xmission.com/~legalize/book/download/index.html> ...
|
| Show full article (3.25Kb) |
| no comments |
|
  |
Date: Jun 10, 2008 12:14
[Please do not mail me a copy of your followup]
Noley Edge gmail.com> spake the secret code
<49bebd17-2fa7-4c48-8c82-d4d3a36dda57@m44g2000hsc.googlegroups.com> thusly:
>
>On Jun 6, 6:40 pm, legalize+jee...@ mail.xmission.com (Richard
>[Microsoft Direct3D MVP]) wrote:
>> IIRC, fixed-function pixel fog can be used with a vertex shader,
>> providing you're not also using a pixel shader.
>
>Section 6.8 of your draft states that pixel fog cannot be used with
>programmable vertex shaders.
Go with what the book says then. When I write stuff for the book, its
because I've researched it and identified the corner cases. When I
post to the net, its usually just form memory, which is subject to
corruption :-)
|
| |
| no comments |
|
  |
Author: Noley EdgeNoley Edge Date: Jun 10, 2008 13:59
On Jun 10, 3:14 pm, legalize+jee...@ mail.xmission.com (Richard
[Microsoft Direct3D MVP]) wrote:
> [Please do not mail me a copy of your followup]
>
> Noley Edge gmail.com> spake the secret code
> <49bebd17-2fa7-4c48-8c82-d4d3a36dd...@m44g2000hsc.googlegroups.com> thusly:
>
>
>
>>On Jun 6, 6:40 pm, legalize+jee...@ mail.xmission.com (Richard
>>[Microsoft Direct3D MVP]) wrote:
>>> IIRC, fixed-function pixel fog can be used with a vertex shader,
>>> providing you're not also using a pixel shader.
>
>>Section 6.8 of your draft states that pixel fog cannot be used with
>>programmable vertex shaders.
>
> Go with what the book says then. When I write stuff for the book, its
> because I've researched it and identified the corner cases. When I
> post to the net, its usually just form memory, which is subject to ...
|
| Show full article (1.21Kb) |
| no comments |
|
  |
Author: Noley EdgeNoley Edge Date: Jun 11, 2008 09:59
On Jun 10, 4:59 pm, Noley Edge gmail.com> wrote:
> On Jun 10, 3:14 pm, legalize+jee...@ mail.xmission.com (Richard
>
>
>
> [Microsoft Direct3D MVP]) wrote:
>> [Please do not mail me a copy of your followup]
>
>
>>>On Jun 6, 6:40 pm, legalize+jee...@ mail.xmission.com (Richard
>>>[Microsoft Direct3D MVP]) wrote:
>>>> IIRC, fixed-function pixel fog can be used with a vertex shader,
>>>> providing you're not also using a pixel shader.
>
>>>Section 6.8 of your draft states that pixel fog cannot be used with
>>>programmable vertex shaders.
>
>> Go with what the book says then. When I write stuff for the book, its ...
|
| Show full article (1.79Kb) |
| no comments |
|
  |
|
|
  |
Date: Jun 11, 2008 10:17
[Please do not mail me a copy of your followup]
Noley Edge gmail.com> spake the secret code
<77b45b07-a70c-442d-a539-97e4ef4170df@b1g2000hsg.googlegroups.com> thusly:
>But even if that is true, then the first pass through the vertex and
>pixel shaders above would not work.
Are you going from what HAL does or what REF does? With tricky
manipulation of the fog states here combined with shaders you could
just be exposing a driver bug. REF is supposed to give you the
definitive answer (and to be honest, I've not encountered any bugs in
REF before).
>By the way, your draft rocksa.
Thanks! I'm glad its helpful to you; that's why I wrote it.
|
| |
| no comments |
|
RELATED THREADS |
  |
|
|
|