Advice needed throughout my first 3D project

Everything related to 3D programming
Seymour Clufley
Addict
Addict
Posts: 1267
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: Advice needed before I begin a project

Post by Seymour Clufley »

Thanks, IV. Do you mean the points of each triangle, or the triangles themselves? I've been wondering whether it will matter which order the vertices are added to a mesh.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Advice needed before I begin a project

Post by IdeasVacuum »

...The points of each triangle. I'd go for anti-clockwise, just incase it matters later.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Seymour Clufley
Addict
Addict
Posts: 1267
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: Advice needed throughout my first 3D project

Post by Seymour Clufley »

I'm making good progress with my project. Here is a screenshot:

Image

But, as you can see, there are no shadows and you can't tell the side of a building from the roof. I did add a light but that had no effect on the scene whatsoever.

Adding either of these lines:
WorldShadows(#PB_Shadow_Modulative)
WorldShadows(#PB_Shadow_Additive)
causes this immediate crash:
Image

Could this be related to the fact that I have no graphics card? I'm using the motherboard's onboard graphics. This seems like a ridiculous question but I have to ask, since everything has been working fine up till now.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Advice needed throughout my first 3D project

Post by Bananenfreak »

I don´t think this will be a solution, but add for every Mesh

Code: Select all

BuildMeshShadowVolume()
.

http://www.ogre3d.org/forums/viewtopic.php?f=2&t=68371
There could also be a Problem with your selfbuild houses.
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Advice needed throughout my first 3D project

Post by Samuel »

Looks like your mesh lacks normals.

EDIT: You can use NormalizeMesh(#Mesh [, SubMesh]) to generate flat shading. Just make sure every face has its own 3 vertices.
If the face is sharing a vertex with a another the command won't work right. The reason is each vertex can only have one normal, but you can have many vertices at the same point each with a different normal. That will give you flat shading and for a building I believe that's what you want.

In order to get smooth shading like for a sphere. You have to calculate the average normal of the faces that are connected at a shared vertex. Then use MeshVertexNormal(x, y, z) to set the individual normal for that vertex.

I'm sorry If I confused you with all this gibberish. I'm not the best when it comes to explaining this stuff. I'm sure you can find some more info on vertex normals with a little searching.
Last edited by Samuel on Sat Oct 05, 2013 6:42 pm, edited 2 times in total.
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Advice needed throughout my first 3D project

Post by Comtois »

without a snipet, it's difficult to say why it crash, may be because you dont use index ?

http://www.forums.purebasic.com/english ... 36&t=56514


[EDIT]
I have tested your code, add this and it will not crash.

Code: Select all

MeshFace(vertex-2,vertex-1,vertex)
Please correct my english
http://purebasic.developpez.com/
Seymour Clufley
Addict
Addict
Posts: 1267
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: Advice needed throughout my first 3D project

Post by Seymour Clufley »

Surprisingly enough, I solved this problem by installing DirectX 9. I already had v11 installed but it seems that PB, or Ogre, relies on v9.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Advice needed throughout my first 3D project

Post by IdeasVacuum »

....Try also Compiler Options/Library Subsystem: OpenGL
DX9c is the highest supported by Windows XP, so maybe that's an Ogre thing. OpenGL on the other hand works with most OS.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Advice needed throughout my first 3D project

Post by Bananenfreak »

DirectX 11 is not an update of dx10 and dx10 is NOT an update of dx9.
These 3 DirectX are not the same and should be all installed (min. Win Vista)
Image
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Advice needed throughout my first 3D project

Post by IdeasVacuum »

How is your project going Seymour?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Seymour Clufley
Addict
Addict
Posts: 1267
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: Advice needed throughout my first 3D project

Post by Seymour Clufley »

Thanks for asking, IV. I'm sorry to tell you that I've had to abandon the project for now. There are just too many things on my plate and this one isn't top priority. My aim was to put the triangulation and other code into Tips & Tricks, as separate code-bases, and I will still do that if I ever return to the project and finish it.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Advice needed throughout my first 3D project

Post by IdeasVacuum »

Well, being busy is a very good thing :)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply