Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / [WIP] 3D HeightMap Loader Library :)

Author
Message
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 28th Jan 2013 02:59 Edited at: 16th Mar 2013 15:39
Here is a small example of a Map produced by L3DT (HeightMap + ColorMap) + a Detail Map and finally rendered with my lib in AppGameKit

The lib create an obj file to render the terrain from the heightmap ( because AppGameKit doesn't permit to create vertices and faces on the fly for the moment )

I will clean the code and publish the complete example project here very soon

EDIT : The Example project is now attached on this post and is over commented lol
EDIT2 : i'm so lazy to add vertices normals (important for dynamic lighting) for the moment but calculating them and add them to the OBJ file is easy if you want to try (or i will add them soon)

EDIT3 : The Zoq2 as ported the code to Tier 2 here : (thanks !)
http://forum.thegamecreators.com/?m=forum_view&t=203224&b=48&msg=2441546#m2441546


The function itself :



Attachments

Login to view attachments
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 28th Jan 2013 06:07


Just that.



Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 28th Jan 2013 07:41
Very nice! And the landscape is shadered too?

The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 28th Jan 2013 08:14
That looks realy awesome
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 28th Jan 2013 09:21
Quote: "Very nice! And the landscape is shadered too?"


Yes i have included the detail shader and a detail map
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jan 2013 09:29
That looks excellent MikeMax! Really nice work


this.mess = abs(sin(times#))
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 28th Jan 2013 09:39
Quote: "That looks excellent MikeMax! Really nice work "


Thanks Bax Do you know if creating vertices and surfaces(triangles) at runtime (and modify them) will appear soon ? it could create a lot of possibilities
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jan 2013 11:46
I don't know, sorry. Certainly not in v108, I would love to have vertex commands!


this.mess = abs(sin(times#))
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 28th Jan 2013 14:47
Is that still simple detail texture tiled on whole terrain texture?
It looks quite amazing.

Also, nice looking water. Is it a simple plain object + one (tiled) texture that is floating up and down?

In any case, good work!

Follow me on twitter! @MotionStruct
Motion Struct blog
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 28th Jan 2013 17:30
Looks really cool

How the h**l did you write the obj creation function

Must be a zillion lines of code.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 28th Jan 2013 17:33
Quote: "Must be a zillion lines of code."


It's actually quite straight-forward.
Read more here:

http://www.eg-models.de/formats/Format_Obj.html

Or here:

http://en.wikipedia.org/wiki/Wavefront_.obj_file

Follow me on twitter! @MotionStruct
Motion Struct blog
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 28th Jan 2013 17:39
Quote: "It's actually quite straight-forward.
Read more here:"

I checked the obj format when i started with the 3d level editor
Its no use for me as i am pretty much limited in lights per object anyway thru shaders on mobiles.
I solved it by using uniqe shaders on objects with more lights.
But by doing so do i nead multiple objects to build the map and its good for the culling also.

But if it proves that a single object would be faster in the future so will i look in to it again.

I am more impressed that he didt get tired if writing the terrain generation code as its alot of lines in an object file

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 28th Jan 2013 19:34
Quote: "Looks really cool

How the h**l did you write the obj creation function

Must be a zillion lines of code."


50-60 lines (for the heightmap analyzer and obj "writer") + 15-20 lines for other things (check if the obj file exist, aply textures/shaders etc...) .. all in one function which returns ... the Object ID of the generated mesh


i will try to publish it (on the same thread) this evening (after work !)
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 28th Jan 2013 23:33
Quote: "50-60 lines (for the heightmap analyzer and obj "writer") + 15-20 lines for other things (check if the obj file exist, aply textures/shaders etc...) .. all in one function which returns ... the Object ID of the generated mesh


i will try to publish it (on the same thread) this evening (after work !) "

Also add it to the codebase
I have started to add a few of my snippets there also as its easy to loose a thread when you nead it then to search the codebase.

Nice of you to share

I learn alot by looking at others code as some people learn by looking at mine.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 29th Jan 2013 02:57 Edited at: 29th Jan 2013 02:57
Source attached to first post ( complete project )
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 29th Jan 2013 12:33
Impressive!


Demo 2 is out! Click the image for more.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 29th Jan 2013 22:41
It whas the normals part that put me off with the object format

Sad that you didt do them in the sample as iam extremely confused over how to calculate them

Could be a great learning experience to get normals working.

Math have never bin my strong point.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 29th Jan 2013 22:57
This is probably the simpliest explanation on how you could achive normals.

But its for someone else as math is a weak point.

http://iphonedevelopment.blogspot.se/2008/12/more-on-opengl-and-normals.html

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 30th Jan 2013 04:12 Edited at: 30th Jan 2013 04:13
this webpage explains the normals very well yes You have everything on this page to add them easily

Exercise 1 : Add triangles normals calculations (i will verify your work ! lol :p)
Exercise 2 : Average them to calculate the common vertex normal. and almost the hardest part lol ... write normals to file :p :



and add their indexes at the end of faces definitions in this format (instead of "f v/vt" only.) :



You have everything in your hands Cliff ! (otherwise you will have to wait for the end of week .. too much work for me this week )
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 15th Mar 2013 16:29 Edited at: 15th Mar 2013 19:43
I felt like using this in T2 so I decided to port it to just that. I am having some problems with the UV cordinates but other than that, i think I got it to work. Do you mind if I post the code here mike?

Edit: I after 3 hours I fixed the error with the UV error. Turns out the function does not save UV cordinates correcly, and if a bad detail map is assigned, it breaks.
erebusman
13
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 16th Mar 2013 03:06
Looks really good mikemax!

I've been using L3DT for a while .. this is a really cool integration of that tool + AGK.

If people keep integrating content creation tools like this AppGameKit is going to start taking off bigtime

MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 16th Mar 2013 08:06
Yes but if AppGameKit could provide a direct Vertices/Faces creation/manipulation at runtime it would be so great !
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 16th Mar 2013 10:47
I thought I'd post the T2 version that I made since it was a pain to get right. If you don't want me doing that, just post here and i'll remove it.



As far as I can tell, everything works like it should.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 16th Mar 2013 15:37
No problem ! post it in the code snippets website section as Tier2 code maybe no ?
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 16th Mar 2013 16:30
That's a good idea, i'll do that to

Login to post a reply

Server time is: 2024-11-23 12:15:44
Your offset time is: 2024-11-23 12:15:44