Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 1219 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
« 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!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen
« 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.
Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


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.
Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


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
« Reply #10 - Posted 2012-12-13 08:14:31 »

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

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


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  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (33 views)
2014-07-18 06:55:21

Zero Volt (29 views)
2014-07-17 23:47:54

danieldean (24 views)
2014-07-17 23:41:23

MustardPeter (26 views)
2014-07-16 23:30:00

Cero (41 views)
2014-07-16 00:42:17

Riven (43 views)
2014-07-14 18:02:53

OpenGLShaders (31 views)
2014-07-14 16:23:47

Riven (30 views)
2014-07-14 11:51:35

quew8 (29 views)
2014-07-13 13:57:52

SHC (64 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!