Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

3D World - Graphics 2.0 Competition Submission
Started by Matthew Pringle Nov 17 2013 12:04 PM

35 replies to this topic
[TOPIC CONTROLS]
Page 2 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

rakoonic2

[GLOBAL: userInfoPane.html]
rakoonic2
  • Contributor

  • 503 posts
  • Corona SDK

Cheers :)

 

Expanding upon what I said earlier, do you need the data returned in any particular format?

I'm thinking of just coming up with a generic 'tiles within a triangle' routine, so the order wouldn't be specific according to the view direction.



[TOPIC: post.html]
#27

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

Its cool you are having a look. At the moment the FOV first finds a list of unordered tiles.

I then sort them by grid order, I'm basically storing tile references. Tile 8 being col 4 row 2 in a 4 x 4 grid etc...

I then sort them with ipairs into an indexed array.

Thats so when plotting the grid I scan horizontally then vertically. So each tile might ( if it exists ) get the corner points of adjacent tiles, making for reduced calculations.

[TOPIC: post.html]
#28

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

Just worked out. With the subdivision. Its best to start into the screen and not at the edges of the screen like I was. It draws a few more tiles, but more are left on screen to help with the effect.

[TOPIC: post.html]
#29

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

Decided to try a different way of removing the polygon gaps / slivers.

Im still subdividing the tile, but before hand I'm scaling by an additional 0.25, where a scale of 0 means the tile would be the original size. Its not enough to alter how it appears on screen but I have yet to see any more artefacts.

[TOPIC: post.html]
#30

rakoonic2

[GLOBAL: userInfoPane.html]
rakoonic2
  • Contributor

  • 503 posts
  • Corona SDK

Yeah expanding ye corners will remove sparklies for sure, but it kinda makes me rebel, as it is part of the OGL spec that polygons that share vertices and an edge should not produce sparklies (although worded a bit more technically than that). T junctions are obviously NOT part of that, but I've seen sparklies anyway, which just makes me sad. Subdividing is not something I'd enjoy doing I must admit - I'd be looking for ways to avoid the need. I think the reason you are hitting the need like this is because of a particularly high field of view (I noticed this from watching one of your vids). A lower FOV would provide less distortion as tiles get closer to the screen edges, but the effect visually from a lower FOV isn't always what is desired, naturally.

 

Glad you sorted that anyway. I'll have a look at my triangle thingy shortly, the idea is it would return a table containing a list of X and Y pairs that determines each cell returned. Do note that triangles aren't actually the shape needed if you have a particularly high vertical angle (that is to say, the more directly down at the ground you look, the less a triangle works as the cull shape would tend towards a box). But for a fairly flat 'looking across the plane' style it'll be fine.



[TOPIC: post.html]
#31

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

At the moment only 2 - 3 tiles are subdivided so its not a big issue. That now happens very close to the bottom of the screen so its momentary at best. I have also dropped the horizontal and vertical subdivisions as they are now no longer needed.

The sparklies were only ever visible at T junctions where a normal tile and a subdivided one met. I nearly scrapped the scaling as it actually introduced sparklies between the subdivided tiles. I have experimented quite a bit and a scale of 1.02 for the subdivided square has worked 100% in all test cases so I am wrapping that bit up now.

As of yet the normal tiles are not producing any sparklies which is good as it saves scaling each tile individually which wouldn't allow me to cache their points for less calculations.

[TOPIC: post.html]
#32

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

Had a quick look at the tile map for mode 7.

Are you using padding for the tiles and drawing a 1 px offset around them? If not thats a cause for lots of edge defects where the texture isn't rendered to the edge of the polygon correctly.

[TOPIC: post.html]
#33

rakoonic2

[GLOBAL: userInfoPane.html]
rakoonic2
  • Contributor

  • 503 posts
  • Corona SDK

Heh I'm lazier than that in the mode 7 demo - all the tiles are just touching so yes it flows over, but I couldn't be bothered to do any more work for what was a throw-away demo.



[TOPIC: post.html]
#34

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

I've semi implemented the cached / pre-rendered fov calculator that uses the camera and dumps a json encoded file of all points visible. This buffering, which will be used at the angle the game is set to run at, to save cycles for other things, takes the rendering time down to 2.5 milliseconds per frame, on my laptop, down from originally about 16ms and with other optimisations it was running at around 5 - 7.

It still needs a lot of work but it looks promising.

[TOPIC: post.html]
#35

rakoonic2

[GLOBAL: userInfoPane.html]
rakoonic2
  • Contributor

  • 503 posts
  • Corona SDK

What does that translate to on devices, any rough idea? Does indeed sound promising, there's nothing like precalculating for speed!



[TOPIC: post.html]
#36

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

Im guessing that it will hold a steady 30fps now on a A4 chipset, it was roughly getting that when the laptop was showing double the time per frame. Will test once I have it working good enough to not crash!

 

I have ordered an A5 iPod Touch ( iPhone 4S equivalent ) to test on. That will be the base device I'm guessing.

 

I think limiting the app to iOS7 would only allow devices with enough power to run the engine at full speed.




[topic_controls]
Page 2 of 2 1 2
 
[/topic_controls]