Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
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  
  Strange 3d rendering issue  (Read 2714 times)
0 Members and 1 Guest are viewing this topic.
Offline Mac70
« Posted 2013-07-25 21:08:44 »

Like in topic. Look at this screenshots:

I am rendering 5X5 collection of 16X256X16 chunks here. I can't get rid of this rendering artifacts and even don't know what is causing them - any ideas why this happens and how can I fix this?

Edit: Source code of this prototype:
Offline RobinB

JGO Ninja

Medals: 44
Projects: 1
Exp: 3 years

Spacegame in progress

« Reply #1 - Posted 2013-07-25 21:11:56 »

Try some mipmapping
Offline Mac70
« Reply #2 - Posted 2013-07-25 21:18:43 »

I am already using mipmapping, but it doesn't help:

int texId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);

        GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);

        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, dec.getWidth(), dec.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buf);

The same problem with any other mipmap mode (even worse with GL_LINEAR_MIPMAP_LINEAR - black lines at the edges of each distant cube).
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2013-07-25 21:34:29 »

Maybe try anisotropic filtering, see GL_TEXTURE_MAX_ANISOTROPY_EXT and glTexParameterf.

Offline Mac70
« Reply #4 - Posted 2013-07-25 21:53:29 »

Now it looks like this (anisotopic 16x in both cases):



Edit: if anyone would like to see code and play around with this prototype, here it is: Smiley
Offline Orangy Tang

JGO Kernel

Medals: 57
Projects: 11

Monkey for a head

« Reply #5 - Posted 2013-07-26 10:59:45 »

Runtime generation of mipmaps varies according to the driver, but usually will just use a simple box filter which results in poor quality mipmaps (particularly with high frequency textures like this). Consider generating the mipmaps offline or manually when you load your texture.

For what you've got, you might want to consider fading your mipmaps to a single solid colour when they get small. Also you've got quite a contrived test case here - I assume in your actual game you're not going to have such big expanses of the same high frequency texture viewed from such a large distance.

[ - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Mac70
« Reply #6 - Posted 2013-07-26 11:13:22 »

I think this is the reason why this problem exists, thank you. Wink
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

numerical (180 views)
2017-02-21 07:32:16

numerical (179 views)
2017-02-21 07:31:46

theagentd (287 views)
2017-02-18 13:42:33

theagentd (288 views)
2017-02-18 13:35:16

h.pernpeintner (1455 views)
2017-01-24 22:39:11

h.pernpeintner (1440 views)
2017-01-24 22:38:32

Galdo (2005 views)
2017-01-12 13:44:09

Archive (2050 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2586 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2332 views)
2016-12-15 21:50:57
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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‑
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!