[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - ARB Vertex Program that Does Nothing?

ARB Vertex Program that Does Nothing?

Discuss programming topics that involve the OpenGL API.

Moderator: InsideQC Admins

ARB Vertex Program that Does Nothing?

Postby jitspoe » Thu Sep 05, 2013 3:46 am


jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: ARB Vertex Program that Does Nothing?

Postby jitspoe » Thu Sep 05, 2013 4:03 am


jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: ARB Vertex Program that Does Nothing?

Postby revelator » Thu Sep 05, 2013 8:02 pm

Not an Expert but i noticed matrix operations tend to scale the shader pic Down. Allthough tbh the only time i seen it was back when i toyed with Water shaders for quake 1.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2605
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: ARB Vertex Program that Does Nothing?

Postby Spike » Thu Sep 05, 2013 8:32 pm

if your vertex.position.w is not 1, try using dph instead of dp4?
make sure your engine does not specify texture coords in pixels, but rather specifies 0-1 instead?
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: ARB Vertex Program that Does Nothing?

Postby jitspoe » Thu Sep 05, 2013 9:29 pm

It's using whatever texture coordinates Quake2 uses.

I think the issue is that the actual UV's passed in originally got ignored due to the qglMatrixMode(GL_TEXTURE); stuff. I'm not sure if I have access to the result of that in the vertex shader. I'm basically forced to pass the vertex UV's. The UV's used appear to be the ones actually set in code, so I guess it's "correct". It's just different from the previous behavior. I'll have to make the vertex program do what the R_LoadReflMatrix() function was doing. It appears that dividing the resulting position x/y/z by w brings the uv coords into screen space, which is what I want.

jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: ARB Vertex Program that Does Nothing?

Postby jitspoe » Fri Sep 06, 2013 3:37 am


jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: ARB Vertex Program that Does Nothing?

Postby jitspoe » Fri Sep 06, 2013 4:09 am


jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: ARB Vertex Program that Does Nothing?

Postby Spike » Fri Sep 06, 2013 3:15 pm

if you're using a texture matrix then you'll probably want to include state.matrix.texture[n] in your program and translate your texture coords by that.

texture coords cannot be interpolated linearly across your primitive (aka: affine rendering, hence distortion). You need the divide-by-w in the fragment program itself.
in glsl: screentexturecoord = ((lerpedscreenvertexpos.xy / lerpedscreenvertexpos.w) * 0.5) + 0.5;
presumably just an extra rcp and a mad in an otherwise uninteresting fragment program. although yes, it does impose an extra texture indirection.
you'll probably want a fragment program anyway if only for a decent fresnel term.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: ARB Vertex Program that Does Nothing?

Postby jitspoe » Fri Sep 06, 2013 7:03 pm

I was able to do the divide by w fine in the fragment program. I'm curious as to why that doesn't have the distortion.

jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: ARB Vertex Program that Does Nothing?

Postby Spike » Fri Sep 06, 2013 8:16 pm

depth distorts. there's no other way to really say that.
simply put, the rasterizer walks the screen in terms of pixels, but as parts of the surface get further into the distance, the worldspace length of the surface that is crossed per pixel gets larger, hence the need for a divide. The GPU normally figures out the correct fractions to interpolate the varyings properly for you, giving perspective-correct texture mapping and stuff. Except you're trying to project your screen image onto a projection, so you need a second divide. or something.
google for homogenous coords or something for actually useful info if you want.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: ARB Vertex Program that Does Nothing?

Postby jitspoe » Mon Sep 09, 2013 4:22 am


jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: ARB Vertex Program that Does Nothing?

Postby Spike » Mon Sep 09, 2013 5:12 am

some lovely curves there...
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to OpenGL Programming

Who is online

Users browsing this forum: No registered users and 1 guest