Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (532)
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 1086 times)
0 Members and 1 Guest are viewing this topic.
Offline Mac70
« Posted 2013-07-25 23: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: https://dl.dropboxusercontent.com/u/67758055/src.zip

Check out my Devblog! Smiley
Offline RobinB

JGO Ninja


Medals: 44
Projects: 1
Exp: 3 years


Spacegame in progress


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

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

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

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
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.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_NEAREST);
       
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, dec.getWidth(), dec.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buf);
        GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);


The same problem with any other mipmap mode (even worse with GL_LINEAR_MIPMAP_LINEAR - black lines at the edges of each distant cube).

Check out my Devblog! Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2013-07-25 23:34:29 »

Maybe try anisotropic filtering, see GL_TEXTURE_MAX_ANISOTROPY_EXT and glTexParameterf.

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

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

NEAREST_MIPMAP_NEAREST:


LINEAR_MIPMAP_LINEAR:


Edit: if anyone would like to see code and play around with this prototype, here it is: https://dl.dropboxusercontent.com/u/67758055/src.zip. Smiley

Check out my Devblog! Smiley
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


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

        GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
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.

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

I think this is the reason why this problem exists, thank you. Wink

Check out my Devblog! Smiley
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.

pw (16 views)
2014-07-24 01:59:36

Riven (16 views)
2014-07-23 21:16:32

Riven (14 views)
2014-07-23 21:07:15

Riven (16 views)
2014-07-23 20:56:16

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

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

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

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

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

Riven (50 views)
2014-07-14 18:02:53
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!