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 Classic Chat / Mesh Creator from an image,

Author
Message
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th Jan 2019 00:50
Hey mate ! that's prety good ....at the end working in a group we can make more .
I'm not a grumpy grandpa
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 03:42 Edited at: 4th Jan 2019 03:44
Thanks Chafari you and puzzler made it possible
I need to perhaps work on a better smoothing algorithm, cos the smooth function messes up the far edges.
but its definitely getting there might even add a pallete and make it so as you can paint on the right of the
screen in a box. then hit extrude button and it will create the mesh. Instead of just loading one

Then we would have a very basic 3D modelling program in AppGameKit using height map techniques
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 06:35 Edited at: 4th Jan 2019 06:54
now implemented a primitive drawing routine in the top right hand corner and a colour wheel below


For those new to the thread the brighter the colour the higher the object will extrude like a height map
its allot easier to use a paint program such as gimp that allows blending etc but I added a primitive drawing tools
so as you can quickly see what it does, no media required
fubar
puzzler2018
User Banned
Posted: 4th Jan 2019 07:14 Edited at: 4th Jan 2019 07:17
Your welcome and nice we got it working, must admit a pretty genius way of doing it.

A very nice example of color wheel too. Im sure now we can add different objects colours in the MTL file too and assign each with the Kd class
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 07:17 Edited at: 4th Jan 2019 09:23
just loading the agk 128 by 128 pixel logo with the only changes is to give it a black bg instead of transparency
it creates this 3d image



or using the blending in a paint program I quickly produced this

fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jan 2019 07:27
haha! Awesome. Superb work
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 07:34 Edited at: 4th Jan 2019 08:24
Quote: " Im sure now we can add different objects colours in the MTL file too and assign each with the Kd class"

That would be handy

Thanks blink

in that example I forgot to call deletedObjects=dohousekeeping() which deletes all the zero size objects ie black ones
but its a 30mb obj so really shouldn't create objects 128 * 128 maybe 64*64 unless they are mostly black


and for those that want a much smaller version with just the letters lexture mapped http://users.tpg.com.au/subarpk/agklogo.rar
fubar
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th Jan 2019 11:28
Wow !! that look awesame !
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 4th Jan 2019 13:53
Nicely acheived indeed - well done guys..
puzzler2018
User Banned
Posted: 4th Jan 2019 14:53
Hi

I have tweaked the exporter to work with meshindexes and colors



It will go to the local appdata
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 16:48
Thanks Everyone

Quote: "I have tweaked the exporter to work with meshindexes and colors"

That indeed works too, loads into blender with all of the colors intact

and gives the following complete code

fubar
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th Jan 2019 17:15 Edited at: 4th Jan 2019 17:17
I'm having problems to execute the program . I only can see the whole painting area if I set 800*600 . If I let resolution 1024 * 768 I just see half of the painting area ? ...not only in this last code but aswell in previous code . Now when trying to load map ..program crash .



I'm not a grumpy grandpa

Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 17:35
Thanks for testing chafari
Quote: " I only can see the whole painting area if I set 800*600 . If I let resolution 1024 * 768 I just see half of the painting area ?"

I would think that's an issue with machines that don't correctly display 1026*768 but il look into it

Quote: "Now when trying to load map ..program crash ."

not sure why, I now when I load a png image I make it a multiple of 2 ie 64*64 or 512*2 etc

I load them in where you see this code
//TO LOAD AN IMAGE ON STARTUP UNCOOMENT ONE OF THE HEIGHT FUNCTIONS AND DOHOUSEKEEPING FUNCTIONS
centreObjId=normalHeightFunction("logo4.png")
//centreObjId=smoothHeightFunction("map.png")
deletedObjects=dohousekeeping()

the problem may be that its not returning a centreObjId, but i thought i removed all those issues, the other thing
it may be is the drawing routine which i may delete yet and just make it an image loader, or perhaps your using to large a png
which is most likely the problem

I added a home function which centers the objects with "Home" key



fubar
puzzler2018
User Banned
Posted: 4th Jan 2019 17:36 Edited at: 4th Jan 2019 17:39
Using similar technique - this adds objects to a meshmemblock instead to an OBJ



Ready for your apps

The face management and vertex sharing to adhere to the greedy alogorithm awaits me

This is so much fun
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 17:51 Edited at: 4th Jan 2019 17:56
@puzzler good luck with the greedy algorythm

@chafari
I just thought is your png transparentThe way its made it wasnt designed for transparent pngs
but ones with black(0,0,0) back ground with RGB color mode, if your using one of my png files scrub that
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 18:04 Edited at: 4th Jan 2019 19:14
Try this one Chafari, I was creating a memblock and storing it for each block for the old merge function I now nolonger do it that way it may have been running out of memory
and commented out the colorwheel and drawing code incase there was some issue there. Also fixed a problem with the objects shown and the new mesh not matching

fubar
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th Jan 2019 18:19
@fubarpk let me a couple of minutes, I'm very clumsy
I'm not a grumpy grandpa
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 18:21
me too and it don't help when the power goes off when your in the middle of doing stuff lol,
fubar
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th Jan 2019 18:26
@fubarpk This last code, is the one you made for the map without the palete ...isn't it ?
I'm not a grumpy grandpa
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 18:28
Quote: "This last code, is the one you made for the map without the palete ...isn't it ?"

Sure Is
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jan 2019 21:14 Edited at: 5th Jan 2019 19:16
Did away with drawing and it now has a mine file loader where you can load an image with a file manager
extrude and then it will save in the same directory as the image. Nothing fancy but it does the job
and the plus and minus keys allow you to set a extrude value prior to extrusion.
Mesh Creator from an image v1.2
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Jan 2019 16:38 Edited at: 5th Jan 2019 18:43
using the above code with the below heightfunction im close with a smoothing algorithm but its only correct on the xAxis
my calculations are a be a bit off



The plan was to only make (width/2)*(height/2) objects from the image and then to adjust the heights relative ot the actual image


Close but no fruit for me lol
any Ideas anyone ?
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Jan 2019 22:44 Edited at: 5th Jan 2019 23:16
Getting closer including the smooth extrude function



try with this test image
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jan 2019 23:14
Very cool! It displays fine, but when I saved the mesh and tried to load it into UU it crashed
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Jan 2019 23:18 Edited at: 5th Jan 2019 23:27
I now have that problem since centering and saving the mtl with lithunwrap but it works fine with AppGameKit and Blender
i find if I load into Blender then Export from blender its fine. Still some issue with the saving maybe il comment out
the mtl file creation
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Jan 2019 23:24 Edited at: 5th Jan 2019 23:28
that fixed the issue for lithunwrap blink I commented out the mtl creation
delete the obj and mtl files and try and recreate

fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jan 2019 23:28 Edited at: 5th Jan 2019 23:49
I think it's the groups. "g" should have a name after it like "g groupname"

You are correct. It's the usemtl lines
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Jan 2019 00:10
interestingly enough
if i use "writeline(fw,"g ") //GROUP" it loads it as joined objects"
if i use "writeline(fw,"g group"+str(t)) //GROUP" it loads as individual objects

i find creating or not creating the mtl function works well with blender
but with lithunwrap it was best to delete or not create the mtl file
which with my example.png only seemed to work for the smooth extrude
which would make me think that lithunwrap cant deal with all the extra groups
that the normal extrude creates
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Jan 2019 01:51 Edited at: 6th Jan 2019 05:51
Finally solved it wasn't the number of groups or objects that lithunwrap didn't like
it was the number of materials, by setting them all to one material it now loads the
larger grouped objects into lithunwrap but with only one material the same
for each that allows texture mapping, but only if there isn't a mtl file created using my tool

Mesh Extrude Tool V1.5
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Jan 2019 01:59
works in UU too
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Jan 2019 02:11 Edited at: 6th Jan 2019 02:22
Wow !! It makes huge files ...more than 30Mb ? Deep Explaration takes 5 minutes to load the file . But it works correctly now...so we can use small image . Tested in Ac3D and Deep Exploration and works Ok .





Edited. I have to say that I try a big image to test if it really works, and I load a big image ...so the generated Obj was nearly 30Mb .


I'm not a grumpy grandpa
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Jan 2019 05:17 Edited at: 6th Jan 2019 19:49
Thanks for testing guys

only thing is the image width has to be an even number and the image height an even number theres no checking for this
so odd numbers will cause a problem

and would be nice to weld similar faces and remove but I think that's a problem for one of the professional
modellers

Edit now when you saves and finishes deleting it loads the object and colors it red to show it saved properly and is working in AGK
Mesh Creator 1.8

Two examples using the smooth extrude option
An Example of what I wanted to use it for small objects like

created from and just made wider

And
created from
fubar
puzzler2018
User Banned
Posted: 6th Jan 2019 10:33
Excellent work Fubarpk as always
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Jan 2019 10:39 Edited at: 6th Jan 2019 11:30
Thanks puzzler was a bit of a headache getting that how I wanted it lol
The smoothing aint perfect but for now we have a mesh extrusion tool
usefool for quick low poly models such as hills, text, logos etc Edit or with
using the normal extrude voxel object creation lol not so sure how useful
anybody will find it

in version 1.8 above I added the option of two way extrusion
an example of 2 way extrusion created from
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Jan 2019 19:05
If you go through all the vertex except those on the base.
Collect vertex that have the same x,z (You'll probably need to round the values a little)
Then make the y value of all those vertex the same as the highest y value in the group
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Jan 2019 20:07 Edited at: 6th Jan 2019 21:05
Thanks blink
I tried so many ways to get the smoothing right I ended up with each pixel in the image representing a vertex
the problem is the next pixel wont be necessarily the same so the adjacent box wil be off. But that gives me the
idea that if i do a second pass and every Left vertex is the same as 2 pixels to the right it may work il look into that
in the future i just couldnt get my head around how when i was doing it lol Or i think your suggestion will work
with a second pass with each left vertex y is equal to previous blocks left y vertex. I might try that later and see
how it goes atm the dog needs a walk lol


Thanks blink it gave me a great idea and now it works
Mesh creator 1.9


now with smoother extracting
fubar
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Jan 2019 21:01
Hi guys

@fubarpk it works really nice ....I think for a voxel world it's pretty much achieved.
I'm not a grumpy grandpa
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Jan 2019 21:08
Thanks Chafari I really wanted to get the smooth extraction working which I think the final version does
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Jan 2019 21:12
Nice!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Jan 2019 21:36 Edited at: 6th Jan 2019 21:38
Thanks
and where it all started was trying to create a quick track to use with blinks car physics
I created an image and using height map methods there was just too many faces to remove
after hence I created this program and below is using my original image I think I need to redo
the image with sides but it shows what I was trying to achieve (I thought it would be quicker &
easier to create Stuntcar racer tracks with this method.)



The ground only needs to be a static plane now
fubar
puzzler2018
User Banned
Posted: 6th Jan 2019 23:33
Just remember where this came inspiration codiing came from to make this occur............
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Jan 2019 23:43 Edited at: 6th Jan 2019 23:44
Yeh I know inspiration from the led board

and help from both you and Chafari
fubar
puzzler2018
User Banned
Posted: 6th Jan 2019 23:45
Keep up the fantastic work
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Jan 2019 23:52
what a joy when things go well
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 8th Jan 2019 21:52
How are we doing .. done any more magical stuff?
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Jan 2019 04:05
Doing well thanks nothing out of the ordinary, but did manage to create 3 raised tracks
I intend to use with blinks car physics, been tinkering with the settings so as the car works properly
intend to do something with the 4wd I created lol its like my first real model in blender. Thinking
I might use the traffic lights as starting lights like they have at the drag strip. I wish we had convexcolliions
concave is fine for the raised road with jumps etc but the problem with concave being that the cars
cant fall off towards the centre of the track, makes sence just don't know how that loop the loop ever
worked now I have a better understanding of concave collisions. Just means I have to create a track
loader now that loads in extras like ramps speedbumps etc and then well on the way to a stuntcar
racer variant. So far only the flat raised roads done, il probably redo the traffics lights shader and I
think with raycasting could add AI cars that look ahead and if there is no ground ahead steer etc that's
the plan no real rush
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jan 2019 00:55
Quote: "Ideally it would be nice now to weld vertices that are close. (blender does have the "remove doubles" option which you set to an amount and it removes vertices)"

fubar

Login to post a reply

Server time is: 2024-04-26 15:06:43
Your offset time is: 2024-04-26 15:06:43