Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
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 681 times)
0 Members and 1 Guest are viewing this topic.
Offline theagentd
« Posted 2012-12-13 02: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 Ninja


Medals: 66



« Reply #1 - Posted 2012-12-13 02: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 02: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!
Play the free demo of Revenge of the Titans!
Offline Roquen

JGO Ninja


Medals: 66



« Reply #3 - Posted 2012-12-13 02: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 02: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 03: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 03: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.
Online ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #7 - Posted 2012-12-13 04: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 05:17:20 »

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

Myomyomyo.
Online ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #9 - Posted 2012-12-13 05: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 Ninja


Medals: 66



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

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

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #11 - Posted 2012-12-13 23: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  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (76 views)
2013-05-17 21:29:12

alaslipknot (88 views)
2013-05-16 21:24:48

gouessej (117 views)
2013-05-16 00:53:38

gouessej (113 views)
2013-05-16 00:17:58

theagentd (125 views)
2013-05-15 15:01:13

theagentd (112 views)
2013-05-15 15:00:54

StreetDoggy (156 views)
2013-05-14 15:56:26

kutucuk (178 views)
2013-05-12 17:10:36

kutucuk (178 views)
2013-05-12 15:36:09

UnluckyDevil (186 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.101 seconds with 21 queries.