News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

3D Textured Cube _ V2

Started by stevmjon, January 30, 2018, 12:40:43 AM

Previous topic - Next topic

stevmjon

hello

  i was looking at the example projects in the PlayBasic Learning Edition "Demo" folder, and had a look at the 3D Textured Cube project.
i started playing around with the settings and worked out a way to get even straighter 2D textures across 3D objects.
i made the texture bend to my will, like the dark side, and had fun doing it.

i made a downloadable demo including the textures(in case you haven't downloaded the demo pack yet). i modified a texture too, and also included this.

i made different settings you can adjust while the project is running, and these are listed at the bottom left of the screen.
i learned a lot from this project, so decided to share this. i hope you enjoy it too.

* See post #5 for updated v3

 stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin

 That's cool Steve,  was going to make a quick video about it last night, but things didn't go that way.. 

  I'm not sure why I didn't just subdivide the faces into an even grid,  which is how a lot morphing shapes done in old demo's.   Ideally I think having a system that pre-compute how the face is cut up before runtime, would be the way to go.   


stevmjon

hey all

i decided to make some pics of a breakdown of the texture sub-divide, for people who don't want to reverse engineer the code.
you will notice that all the extra points that are calculated come from the original corner points of the polygon.

  hope you learn from this, or get new idea's.

  stevmjon

p.s. i am glad you like this kev, i have been thinking about this for a while now, and the original demo you made gave me idea's.

It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin

#3
 Steve,  
     
     I think as along as the area of the sub-divided  face is about even then it should work well enough.  Ideally you'd build a few different versions of the each mesh so that when the object is near the camera, it's being presented with the higher polygon verion which would drop away as the view moves away  (LOD - Levels of detail).  Which is pretty standard to this day..  

     Moreover, when the object is far way it should use a mip mapped texture (a scaled / blurred version ) of the texture for the different different depths.    Smaller textures are quicker to render and reduce the pixel noise of objects far away.    You can turn on Bi-linear filtering is one of the terrain demos uses to hide the lake of perspective..   

  See the   PS3D - Simple 3D For PlayBasic V1.64 thread for some old examples



   




kevin

PlayBASIC LIVE: Steves Textured Cube Update and 3D Terrain (2018-02-13)

Today we'll take a Steve's update to the texture mapped cube demo, the update looks at various methods for sub dividing the cube faces to make the texture mapping more perspectively appealing visually. After that, I look at the classic Terrain and particle demo's which can also be found in the PlayBASIC
learning edition project packs.

#texturemapping #3d #basic #perspective
Music: http://www.bensound.com
Home: http://playbasic.com



stevmjon

3D Textured Cube v3

well, i couldn't help myself but to play around with the sub-dividing a little more and got it a little better, also with less polygons.
i was looking at a way to not divide the outer edges because this left a very small gap when other non sub-divided polygons were touching(connected to it).

so i added this extra sub-divide to the demo, and also a quad poly too for comparison.

spacekey changes the draw mode, and so does 1 - 6 number keys to directly select mode, so you can choose which ones to compare to each other.

  enjoy stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.