Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Design Considerations for 3D “Tile” Maps  (Read 1023 times)
brimstone
Community Member
*
Posts: 300


WWW
« on: July 24, 2008, 03:59:07 PM »

I need some help addressing some lighting and vertex issues because I don’t know how to deal with them.

Initially my plan was to use a series of cubes to create a map using textured cubes and bumping them together. (see screen shot) The idea is just like the iso maps of old, except now with three dimensions instead of two. This kind of map will greatly simplify my goals to concerning random maps. I generated these with the Mesh.CreateBox() method.

Ok, here’s the catch, when I bump all these cubes together they have independent vertex and tris. So, when you throw on some vertex lighting, instant crap. It works like a charm until I toss on the light.

So, I’ve been thinking about how best to address this because individual cubes to represent a n x n x n dimensioned piece of game map will not work if I want to property light the scene.

I can ‘stretch’ cubes into rectangles and overcome the lighting problem, except now I have problems with texture alignment and texture ‘stretching’. The textures were intended to be n x n in dimension and NOT stretched along one dimension via n x n  or more. I’ll also want different n x n dimensioned textures on different parts of the wall (just like a tiled iso engine) so not having uv’s

I need some suggestions on how to resolve these issues. (Lighting or texturing, depending upon approach). I hope I’ve made the context of the problem clear. Please let me know if I’ve babbled and not made myself clear.


Logged

Project: ^
Status: ^^.^% complete
dxman.net
Zaknafein
Customers
Community Member
*****
Posts: 2674


WWW
« Reply #1 on: July 24, 2008, 04:40:42 PM »

This happens because of two reasons :

- TV3D defaults to Gouraud shading, which interpolates the normals between vertices. You can revert this with TVScene.SetShadeMode() and choose FLAT shading, if that's what you want.

- CreateBox() makes a box such that vertices are shared across different faces. It's pretty much impossible to have per-face normals while sharing vertices. To prevent that you'd need to rebuild a box with AddVertex(), etc.

Although if you want per-pixel lighting, not flat per-face lighting, you need to use a bump-mapping lighting mode and flat normal-maps on your cubes.

http://en.wikipedia.org/wiki/Gouraud_shading
http://en.wikipedia.org/wiki/Phong_shading#Phong_interpolation
« Last Edit: July 24, 2008, 04:44:03 PM by Zaknafein » Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
brimstone
Community Member
*
Posts: 300


WWW
« Reply #2 on: July 24, 2008, 05:04:18 PM »

Thank you, this will give me some things to experiment with.
Logged

Project: ^
Status: ^^.^% complete
dxman.net
brimstone
Community Member
*
Posts: 300


WWW
« Reply #3 on: July 27, 2008, 04:18:10 PM »

I did some experimenting which led to unsatisfactory results. I ended up staying with the normal map route as bumping will have to happen. (sorry for any stupidity on my part its been a while) The issue now is that each of thee cubes gets lit, instead of say a 1 piece wall with the same dimensions as the multiple cubes. (see the screen shots)

Now, I tried AddWall3D and got similar results if I use pieces. If I ‘stretch’ 1 wall to the correct dimensions, the lighting is now correct. However, the texture and normal map is now stretched. The tile methods in AddWall3D also look to be broken (added to BTS) but I can code up this simple geometry myself so I can proceed, the problem is I can’t simply tile every wall.

I need to be able to tile OR use different textures on different sections of the wall.

How do I address this need?  I am considering ‘baking’ a texture that is the appropriate scaled dimensions using the various ‘layers’ I’ll be applying to proper sections but this seems overly complex. Can I not simply specify where on the ‘Wall’ I want texture ‘x’ to appear and specify texture ‘x’ dimensions?

Thanks in advance for your advice.

Individual pieces of wall.


Same as above but textured


One Long wall. (Lighting that I'm looking for)


Above textured

Logged

Project: ^
Status: ^^.^% complete
dxman.net
pizzayoyo
Customers
Community Member
*****
Posts: 1320


WWW
« Reply #4 on: July 27, 2008, 04:38:36 PM »

Calling ComputeNormals on your boxes might help.
Logged

Zaknafein
Customers
Community Member
*****
Posts: 2674


WWW
« Reply #5 on: July 27, 2008, 05:32:00 PM »

That's strange, but not unheard of.
http://www.truevision3d.com/forums/tv3d_sdk_65/normal_mapping_issue-t18025.0.html

Try what's mentioned in that thread.
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
brimstone
Community Member
*
Posts: 300


WWW
« Reply #6 on: July 28, 2008, 09:47:48 PM »

@pizzayoyo: thanks for the suggestion, but I've already been calling ComputeNormals().


@Zaknafein: I read through the post, it looks unrelated to my problem in that the other guy had 1 mesh, when I have 3. When I use 1 mesh the problem with lighting goes but pops up the stretching and other texture related problems.

For the time being I'm going to give it a go at baking my textures and see how that works out. If anyone comes up with anything better please let me know.

Thanks for your input.
Logged

Project: ^
Status: ^^.^% complete
dxman.net
Zaknafein
Customers
Community Member
*****
Posts: 2674


WWW
« Reply #7 on: July 29, 2008, 09:08:45 PM »

That's really wierd... Huh

Have you tried working with AddVertex instead of AddWall? This way you could make 100% sure that your normals stick out the right way.
There's a good tut on the wiki : http://wiki.truevision3d.com/tutorialsarticlesandexamples/building_a_cylinder
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
brimstone
Community Member
*
Posts: 300


WWW
« Reply #8 on: July 30, 2008, 07:40:31 AM »

Zaknafien,

That is probably what will happen. I'm experimenting with some of the UV related methods for TVMesh to see if I can get them to work for me. If those fail, I'll have to build the geometry.
Logged

Project: ^
Status: ^^.^% complete
dxman.net
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks