Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 rendering carryover in lwjgl voxel project  (Read 935 times)
0 Members and 1 Guest are viewing this topic.
Offline BrassApparatus

Junior Devvie





« Posted 2013-06-28 02:22:35 »

It's me again. This one is really eluding me. I slapped together some code for a voxel rendering engine and I'm in the process of cleaning it up and optimizing it. I'm using VBO's and VAO's and I just converted from using IBO's to not. I also just changed the way my vertex/color data is passed and the structure of my shaders. the method I was using can be seen in my renderplayer() method as I haven't bothered updating it yet. The next step is changing all of my rendering data to shorts or bytes.

All of my chunks were rendering properly before but now I get a weird errror where any chunk that is not init'd with the default configuration appears to -I'm gonna say- bleed over the three chunks preceding it in the list of chunks.
I am seeing the preceding chunks render as if they had block list composed of both their own and that of the offending chunk.



I've numbered chunks 0-5 here in blue and circled the offending chunk. Number 5 should appear as a y=x structure with no red base and the others should appear as y=0.
In addition I've pointed out a weird thing where chunk[offending - 3], in this case 2, renders differently from the others.

When I check the block list of my chunks they appear correct. The list of vertices for each chunk is the correct length, and the engine appears to be rendering the proper number of chunks.

Here is my code.

Engine.java // rendering happens here
ChunkManager.java //very short
Chunk.java //short
Shaders
Player.java //should be of no use as far as this error
Utils.java // only included for completeness


I'm posting here because I can't find my error and I'm not sure if it's some stupid numerical typo or a fundamental misunderstanding of the rendering process I've built.

Thanks all in advance,

EDIT: Almost forgot to mention that my engine extends a program written ra4king and uses another.
They're here.
1
2
They too are included for completeness.
Offline BrassApparatus

Junior Devvie





« Reply #1 - Posted 2013-06-28 09:12:58 »

It's me again everyone.
I've altered the code for generating a "default" chunk. Now the code makes the flat red plane, previously at y=0, generate at y=chunk.x. This made me realize what I should have been acutely aware of all along. There is no 'offending' chunk. Every chunk seems to bleed over the previous chunks. PIC I have continued combing my code and now suspect more than ever that I fundamentally misunderstand the rendering process I've set up. I'd really appreciate someone straightening me out here as I'm thoroughly missing the point.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
private void initDefaultBlockList(int x){
      for (int i = 0; i < CHUNK_SIZE; i++){
         for (int j = 0; j < CHUNK_SIZE; j++){
            for (int k = 0; k < CHUNK_SIZE; k++){
               if(j==x)
                  defaultBlockList[i][j][k] = 1;
               
            }
         }
      }
   }


That's the applicable portion of changed code (from Chunk.java).

I am still sure that:
a. The chunks contain the proper number of blocks.
b. The chunks list of vertices are the proper length.
c. The engine is not rendering duplicate chunks.
All of this prints to the console when the program inits.

I therefore assume that I have massively screwed up my rendering (possibly with vbos?).
Offline BrassApparatus

Junior Devvie





« Reply #2 - Posted 2013-06-30 09:07:39 »

Just one shameless bump.  Clueless 
If there's anyone who looked at this I could use the advice. I'm at the point of rewriting everything from the ground up.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline UprightPath
« Reply #3 - Posted 2013-06-30 10:28:57 »

I have a guess! A big guess, but a guess none the less! If you have the red at y=0 over the entire set of chunks, and then have the green over it, then what's happening is a bug that occurs when you attempt to put two triangles in the same space. They overlap in funny ways (The depth isn't found correctly). Try rotating and see if there's any flicker (Red to green, green to red) if it does, then that's your problem. :3

Offline BrassApparatus

Junior Devvie





« Reply #4 - Posted 2013-06-30 22:44:22 »

I don't think that's it. Sad I have the camera rotating and there's no flicker. The default y=0 layer is only created if a chunk is initialized without a list of blocks. Thank you though! Any other ideas??
The problem is that every chunk is imprinting over the three chunks preceding it. No idea how.
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.

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

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

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

BurntPizza (93 views)
2014-12-08 04:46:31

JscottyBieshaar (53 views)
2014-12-05 12:39:02

SHC (69 views)
2014-12-03 16:27:13

CopyableCougar4 (71 views)
2014-11-29 21:32:03

toopeicgaming1999 (131 views)
2014-11-26 15:22:04

toopeicgaming1999 (122 views)
2014-11-26 15:20:36

toopeicgaming1999 (34 views)
2014-11-26 15:20:08
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

List of Learning Resources
by SilverTiger
2014-07-31 16:29: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!