Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (744)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (825)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Basic diffuse lighting giving artifacts with MSAA  (Read 3594 times)
0 Members and 1 Guest are viewing this topic.
Offline theagentd
« Posted 2012-12-13 01:04:55 »

Hey. I've had a bug with my lighting shader for a while now and I thought I'd ask if anyone knows anything about it. With multisampling enabled I get single-pixel artifacts where the lighting computation gives a much higher value than it should. The artifact happens on triangles that are almost 90 degrees aligned to the screen (almost invisible/very "thin"), around the outline of smooth objects. This is my shader line to calculate the light intensity from a point light (no distance attenuation).

1  
float light = max(dot(normalize(normal), normalize(lightPosition - eyeSpacePosition.xyz)), 0.0);


Here's a screenshot of the artifacts that keep on flickering when the camera moves. There's no texturing or anything, I just output the above light value the RGB channels. This is with 2xMSAA but it's more or less visible at any sample rate.



I have a hunch that this is due to the fact that the normal becomes extrapolated for those edge samples and somehow wrap around or something. If that's the case, then the only solution I know of is to enable centroid interpolation, which is an OGL4 feature. -_-'

Myomyomyo.
Offline Roquen

JGO Kernel


Medals: 516



« Reply #1 - Posted 2012-12-13 01:13:46 »

Uggh:  Errr..try looking at this: http://mynameismjp.wordpress.com/2012/10/28/msaa-resolve-filters/
Offline theagentd
« Reply #2 - Posted 2012-12-13 01:16:13 »

The resolve is done by OpenGL, I'm just requesting a pixel format with MSAA:

1  
Display.create(new PixelFormat(24, 0, 24, 0, 2));

Myomyomyo.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen

JGO Kernel


Medals: 516



« Reply #3 - Posted 2012-12-13 01:19:27 »

Just looking at your image it looks like aliasing...so the resolve might be the problem.
Offline theagentd
« Reply #4 - Posted 2012-12-13 01:23:04 »

Nope, it was the interpolation. I accidentally spotted that centroid interpolation was in fact supported in OGL3 and tried it and that fixed it.

EDIT: More info: http://quest3d.com/forum/index.php?topic=69239.0

Myomyomyo.
Offline davedes
« Reply #5 - Posted 2012-12-13 02:25:39 »

Is this real-time medical graphics programming by any chance? If so, how do you get into a field like that?

Offline theagentd
« Reply #6 - Posted 2012-12-13 02:36:43 »

Is this real-time medical graphics programming by any chance? If so, how do you get into a field like that?
? Not at all, that's just a 3D model without any textures.

Myomyomyo.
Offline ra4king

JGO Kernel


Medals: 506
Projects: 3
Exp: 5 years


I'm the King!


« Reply #7 - Posted 2012-12-13 03:59:47 »

Haha it looks a lot like a bone, which is why davedes thought that Wink

Offline theagentd
« Reply #8 - Posted 2012-12-13 04:17:20 »

OH! xD But it's not a bone, it's a butt! xDDDD

Myomyomyo.
Offline ra4king

JGO Kernel


Medals: 506
Projects: 3
Exp: 5 years


I'm the King!


« Reply #9 - Posted 2012-12-13 04:23:10 »

That's an ugly flat ass Grin

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen

JGO Kernel


Medals: 516



« Reply #10 - Posted 2012-12-13 07:14:31 »

Damn, that should have obvious...but I doubt I would have thought of it.
Offline ra4king

JGO Kernel


Medals: 506
Projects: 3
Exp: 5 years


I'm the King!


« Reply #11 - Posted 2012-12-13 22:46:18 »

Damn, that should have obvious...but I doubt I would have thought of it.
Errm...you accidentally a word Tongue

Pages: [1]
  ignore  |  Print  
 
 

 
Ecumene (150 views)
2017-09-30 02:57:34

theagentd (225 views)
2017-09-26 18:23:31

cybrmynd (303 views)
2017-08-02 12:28:51

cybrmynd (291 views)
2017-08-02 12:19:43

cybrmynd (299 views)
2017-08-02 12:18:09

Sralse (292 views)
2017-07-25 17:13:48

Archive (980 views)
2017-04-27 17:45:51

buddyBro (1105 views)
2017-04-05 03:38:00

CopyableCougar4 (1685 views)
2017-03-24 15:39:42

theagentd (1433 views)
2017-03-24 15:32:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!