Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


textured bitmap distortion


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
20 replies to this topic

#1 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 August 2001 - 12:20 AM

I''m using a 16x16 bitmap of a circle as a texture placed in a 2D projection over a 3D model to indicate a site of interest to the user. He can also attach a textual label to the circle. Everything works fine most of the time, except on a few locations as I move the eye position around, the circle distorts by moving the right row of pixels to the left side (always right to left, never left to right). I have GL_CLAMP for the WRAP_S/T value, so it should not be wrapping the texture. It''s only an annoyance, but it''s distracting as you move thru the model. Anyone else see this or have any ideas on what is happening? Thanks in advance.

Sponsor:

#2 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 14 August 2001 - 05:55 AM

I guess no one has this problem. I have a picture, but my web site is down and have no where to post it.

As for more information, just changing the viewport size can cause the problem (where the circle is fine, but changing the aspect ration will distort it).

-dantas

#3 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 14 August 2001 - 06:10 AM

Are you using the texture in ortho mode on a 16x16 pixel quad?

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#4 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 16 August 2001 - 06:56 AM

Yes I am. I''m not doing anything fancy, it just a simple texture marker with some text. That''s why I''m so stumped.


#5 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 16 August 2001 - 09:39 AM

Have you tried it on more than one video card? Maybe it is a small driver glitch.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#6 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 August 2001 - 02:20 AM

Actually, I hadn''t thought of that because more than one of us has seen the problem. So I dug around here and found that almost all of us use the nVidia TNT2 board. I was able to find a couple of other boards to try it on (including a GEForce2) and the problem was still here.

Is it possible that the texture quad can be displayed other than perpendicular to the eye vector? Since I''m drawing using ortho projection, I didnt think so.

#7 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 20 August 2001 - 06:51 AM

Sure can. All the ortho does is get rid of perspective, it doesn''t eliminate z coordiantes. I also read your second post and was wondering if you are changing your perspective when you resize your viewport. That would cause the geometry to appear to stretched if you didn''t redo the aspect ration.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#8 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 August 2001 - 07:45 AM

Well, at first I thought so too. I added code to first store the original z coord and then added random number z coord to the vertices for the quad. Any value of the z coord that was close to the origiinal value had the same problem. The random numbers caused the texture to not be drawn (as expected. GIGO!).

I have the depth buffer disabled, so the z coord should not matter and the texture should be drawn perpendicular to the eye vector. Or am I missing something?

As for the perspective when the viewport changes, no, it's not changed unless the user changes the model. The objects in the viewport are not changed, only the background grows or shrinks with the change in the viewport. The objects are not even recalculated, the display lists are just called.

Edited by - dantas on August 20, 2001 2:52:01 PM

#9 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 20 August 2001 - 08:18 PM

You probably need to change the projection matrix every time you change the size of the viewport.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#10 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 August 2001 - 05:47 PM

I thought about that and forced the display list to be regenerated each drawing cycle, but that didnt help. I went into the code and add an update to the projection matrix each drawing cycle to, just to see if it helped, but it didnt. The matrix changed very little as I moved the eye position because I have it very far out by default.

It has to be something due to the motion and angle of the textured quad relative to the eye vector, but I cant think of
anything else to try. And of course, it only happens at a very small percentage of the screen and it''s unrelated to were on the screen. I''m at a loss, so anything you can think might be causing it, no matter how obsecure, I''m willing to try it.

#11 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 22 August 2001 - 05:24 PM

YOu should not have to recompile any display lists or change the projecttion matrix every frame. Only change the projection matrix once, when you resize the viewport.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#12 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 August 2001 - 07:04 AM

Yes, I agree, but it happens when the viewport is not changed also, just by moving the eye position as the user flies thru the model. It seems anything that changes the relationship of the eye to the texture can cause the warping of the texture, but only in a small number of relationships. And I cant seem to figure out what to do to fix it. I''ve tried recreating everything and regenerating the display lists, but keeping that relationship keeps it distorted. I thought of hacking it so that I move the eye just slightly, but I''m sure I would find a new position that was just as bad and gain nothing.

I''ve got access to my companies ftp server finally, so here is a picture of good vs wrong.

ftp://al.al.autometric.com/pub/incoming/Texture_Warp_Problem.gif

#13 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 27 August 2001 - 04:46 PM

I tried to look at it but there appears to not be any files in that directory. Are you sure someone outside your firewall can look at it?

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#14 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 28 August 2001 - 05:26 AM

Yeah, I had it tried on Friday and it worked, but it doesnt now. We had our intranet converted over the weekend to link up with our new parent compnay and now even I cant get to the file.

I can email it to you if you want, let me know.

#15 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 28 August 2001 - 06:05 AM

THat is just fine with me. If you want to send the offending code that is just fine also. Don''t need everything just the graphics code.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#16 Succinct   Members   -  Reputation: 169

Like
Likes
Like

Posted 28 August 2001 - 06:15 AM

I know it''s only treating the symptom, and not the problem, but have you tried GL_CLAMP_TO_EDGE (0x812F)? It''s a part of the 1.2 implementation. If you''re headers don''t have it defined, through the above in as a define and see if it works. Most implementations are 1.2, though most headers are 1.1.

Thank you for your bandwidth.
-- Succinct
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




#17 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 28 August 2001 - 06:40 AM

Yes, I tried CLAMP_TO_EDGE when I saw it on another post, but it didnt help.

#18 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 28 August 2001 - 05:38 PM

It looks like the circle and the text is rotated on the yaxis. I would need to see the rest of your code, especially the perspective calls and your display lists building to help more. The code you sent looked fine. I thought maybe there was some kind of rounding error in gluProject that was shifting the screen coordinates but that should not be a problem.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#19 dantas   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 October 2001 - 11:34 AM

I have come across the fix. It seems that textures that are less than 32x32 get distorted at the edge if using any of the CLAMP values for WRAP_S/T. Once I forced the texture minimum to be 32x32 (the bitmap I was using was 16x16), everything looked fine. This was true of the text too (since in some cases the texture was 2x16).


#20 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 01 October 2001 - 01:15 PM

Make me wonder if there is a bit shifting problem in the driver/hardware.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS