Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Bad UV coordinates in DBPro plane objects ( Make Object Plane / Plain )

Author
Message
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 22nd Sep 2010 21:46
I have found what initially seems to be a UV coordinate problem for DBPro internal plane objects.

The example renders a textured screen quad made with 'Make Object Plain' and a quad effect file.
Holding the Shift key, the object is hidden and a sprite with the same texture can be seen.

The upper left corner appears displaced in the plain object version.

The sprite output shows very slight differences with the original texture, which seems acceptable.
However the difference of the original tezture with the plane texture is quite noticeable, except for a small triangle in the bottom right corner.

These pictures show the problem:

Here the plane, shows a diagonal seam from bottom-left corner to top-right corner. Also a blue line appears in top and left sides:


The same output for the sprite, there are no seams:


This is the difference with the original texture for the plane:


This is the difference with the original texture for the sprite:


This is the difference with the original texture for the plane, with comments:


I attach a project file with executables and all, so you can quickly tell the difference.

Any fix for the screen quad plane? This error is affecting most (if not all) full screen shaders.
I would like to fix the object plane or the adapt the quad.fx shader file.
I have tried to load external custom plane objects, but they do not seem to like the quad.fx file, as nothing appears on screen.
Any help is much appreciated.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Sep 2010 22:09
The plane receives vertex diffuse lighting. Have you allowed for that?
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 22nd Sep 2010 22:51
Hey thanks GG I was about to let you know about this

Quote: "The plane receives vertex diffuse lighting. Have you allowed for that?"


Uh, Have I? Sorry I do not fully understand the question, isn't that by default?

This is the DBPro code, but it needs the media attached in the previous post:



And this is the Quad.fx code:



There is no lighting for the plane, other than the one at the shader.

The key problem for me is that I need precise texture output for the star background, preferably using a screen quad for full screen shaders, and so far only a sprite can give the expected precision.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Sep 2010 23:32
Er, sorry. Didn't read your first post properly.

The only problem I can see is the following.

In the dba file:



In the shader:



This looks like an error originating with DarkShader to me.

I guess InvViewSize defaults to zero so the image isn't being shifted. But why you get the seam escapes me (actually I can't see the seam in the first image ).
Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 23rd Sep 2010 03:46 Edited at: 23rd Sep 2010 03:46
Can be rasterization offset.

The bloom fullscreen shader included in Dark Shader compensates in the final pass like so (from the bloom.dbs shader):


The url in the comments there explains it too.

If you do not compensate the offset it will be a pixel width top and left where the backdrop shows. I have seen this in many commercial titles, pretty sloppy.

Regards
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 23rd Sep 2010 13:49 Edited at: 23rd Sep 2010 13:59
Allright problem solved
Thanks both for your tips, finally it was a mix of both reasons.

To make it work, change the dba code:



to



Shader file doesn't need any changes.

This is now the difference between the original texture and the output of the screen quad (correct):



So I recommend to review any shader implementation with screen quads out there.

Many thanks for your support, now to try it with the real project

[EDIT: The reason why I recommend to review full screen shaders is because the original code was not mine, it was taken from TGC Dark Shader examples.]

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Sep 2010 14:19
Quote: "The reason why I recommend to review full screen shaders is because the original code was not mine, it was taken from TGC Dark Shader examples."


Yes, that was the problem I was referring to. Glad the fix worked.

Login to post a reply

Server time is: 2026-07-22 12:41:37
Your offset time is: 2026-07-22 12:41:37