Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (605)
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 1418 times)
0 Members and 1 Guest are viewing this topic.
Online theagentd

« JGO Bitwise Duke »


Medals: 367
Projects: 2
Exp: 8 years



« 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
« 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/
Online theagentd

« JGO Bitwise Duke »


Medals: 367
Projects: 2
Exp: 8 years



« 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
« 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.
Online theagentd

« JGO Bitwise Duke »


Medals: 367
Projects: 2
Exp: 8 years



« 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?

Online theagentd

« JGO Bitwise Duke »


Medals: 367
Projects: 2
Exp: 8 years



« 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: 356
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

Online theagentd

« JGO Bitwise Duke »


Medals: 367
Projects: 2
Exp: 8 years



« 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: 356
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
« 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: 356
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  
 
 
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.

Elsealabs (16 views)
2014-12-28 10:39:27

CopyableCougar4 (20 views)
2014-12-28 02:10:29

BurntPizza (25 views)
2014-12-27 22:38:51

Mr.CodeIt (15 views)
2014-12-27 04:03:04

TheDudeFromCI (20 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (58 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (96 views)
2014-12-09 22:41:13

BurntPizza (115 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
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!