Improving rendering quality with loaded model files

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Silbermünze
Posts: 34
Joined: Thu Sep 15, 2005 12:27 pm
Location: Stuttgart, Germany

Improving rendering quality with loaded model files

Post by Silbermünze »

Hello everyone!

My question mights sound quite newbish and possibly is due to my lack of knowledge of correctly setting up the irrlicht engine, but I tried to get my example program rendering correctly for over 2 weeks now.

My basis is the "01 Hello World" example from the Irrlicht package.
I changed the file to be loaded from "sydney.md2" to the earth.x file included in the media directory.
In addition I turned on lighting and placed a light in the scene by using

Code: Select all

ISceneNode* light = smgr->addLightSceneNode(NULL, vector3df(5,5,-2),SColor(0,255,255,255));

node->setMaterialFlag(EMF_LIGHTING, true);
node->setMaterialFlag(EMF_GOURAUD_SHADING, true);
node->setMaterialFlag(EMF_BACK_FACE_CULLING, true);

As texture I use a earth satelite image in jpg format.
When I now render the scene the rendering is far from smooth at the edge where the light-side meets the shadow-side of the earth sphere. The triangle structure of the mesh can be clearly seen through the shading.
Have a look at the following image to see what I mean:
http://www.silvercoin-gamedev.de/images ... tearth.jpg

How can I avoid these "ugly" shadowed edges and get a smooth gradient from light to dark side? This question basically relates to " How to do it with Irrlicht" and not in general. Is there something that has to be taken care of when generating the model files in the modeler apart from generating normals? I used different formats ranging from 3ds,x to my3d and ms3d, so it is not a problem of the file format.

Thanks for any help
Silbermünze
FrSl
Posts: 19
Joined: Thu Jan 19, 2006 5:03 pm

Post by FrSl »

Yes, I have this problem too,

Didn't had the time to sort it out yet but my round balls in my current snooker project have the same problems. They look more like golf balls now :P

Image

It's probably only changing 1 or 2 flags, but which one. :roll:
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

well, it's clearly normals stuff.

I allways check there's no double faces or something.

I tend to apply a low autosmooth value, or put enough "hard edges" manually, if done by hand instead of a thresold (ie: 45. 45 will usually be good to make disappear normals darkening, which you apreciate there)

Just a random guess, but try to aply an autosmooth value, with harder value, while I don't think is good to make the facets appear, you may find it works well, after all, often 3d meshes to weird things in engines...Try.

Another possibility: the sphere is an md2, or was converted to md2 at some point. Md2 has usually no float precission, and this end ups in bad repositioning of vertices, weird transforms sometimes, indeed. No matter is now an x, it could have got the deforms,an now the surface is not perfectly smooth in its spheric form.

Another possibility, the code for loading md2 treats meshes like md2, so, the shadowing , normals, or vertex position accurateness, is treated same way....You surely will need to load as x, like an x is loaded.But I can't help more, as I am not a coder, and I don't know irrlicht engine.
Finally making games again!
http://www.konekogames.com
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

oops
fsl posted while I was posting.


frsl, your problem is the opposite. Those spheres simply have no normals info. Reason why you see em so. That's really easy to fix. Post em and tell me the format, I'll upload a version fixed in the whatever format asked. But by all means, I'd recommend OBJ or x... to use in engine. Unless some of the hybrid new loaders , or any other user developing made better support.

I specially like OBJ for non character objects, but that's me.

I should make an art support section here, hehe.

well...you can even fix the stuff, you two. I'll explain:

In Blender : edit buttons, "set smooth"

In max, autosmooth button. Or select all faces, "clear groups" , then apply "1" group. For example.

In Milkshape , select all faces, groups tab, "clear all", and with all selected, asign clicked, hit "1" (for example)

In wings, edge mode, select all (ctrl a) , right mouse button anyway out of the model, choose "hardness" , select "smooth". Export as obj with nromals, smooth etc clicked.

other way in wings, you can use "autosmooth" just like in Max. Go to object mode(las icon up above, of the four which are togehter) , with object selected (red) , Right mouse button, "autosmooth", set the threshold angle, which could be something between 45 -60, or othe rnumbers, just try. Often depends on th efinal ogl viewer or engine.

This explanation will work for both, but for earth case, try first the "autosmooth" way. And for this stuff lately I'd prefer Wings than Max...specially as I really think the obj export for wings is rather better than the obj exporter available as third party for max....but also as wings keeps stuff in modelling fast, direct, straight forward, and simple to learn. And it's free. the best modeler. Ever. ;)
Finally making games again!
http://www.konekogames.com
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

I'd like to test that billiard game. :)


I like pool game.


btw, to huge table, no? maybe some sort of googleing to find relation ship of proportions ball<-->table, may help you a lot. :) Just a perfect foto from above would help you :)


Also, table has no lighting/shadowing yet, so walls aren't seen for that.
Finally making games again!
http://www.konekogames.com
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

camera fov.

you may want to tweak it a bit, but carefully, as is good to have a global view when playing pool... rather hard to say, would have to test with several fovs to say what's the best.

A wide fov like u used, gives more field of vision, but also deforms more. less deformation, less things seen ata time. It's allways a matter of the game itself.
Finally making games again!
http://www.konekogames.com
FrSl
Posts: 19
Joined: Thu Jan 19, 2006 5:03 pm

Post by FrSl »

Thanks for the help Vermeer,

I'm only a basic 3ds max user and don't know all the features. I'm not at home now, but i'll try it when i'm at home this evening.

[offtopic]
to huge table

The idea was to create a snooker game, a snooker table is bigger then a pool table(the table is created with 100% wiki size values). But yeah the balls on the table are pool balls :P still need to make a second table/ball set with snooker balls.
camera fov.
The point of view is done with total free movement around the ball and zoom in/out function, also the angle of how the player can look over the keu is adjustable with the mouse. While shooting the camera is moving to 1 of the corners of the table to get a tv effect and to get some overview of the table.

But yes the graphics do need some improvements but that will change later on. Maybe after that i'll bring out a beta for testing. I'm glad you like it.
:)
[/offtopic]

I'll test you're ideas this evening and will tell if the problem is solved :)

Thanks for the help.
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

a pleasure to help :)

Max?

Then :

- select the ball
- in the modifier tab at the right, that is, second icon/tab in the the right panel, as you know, you can scroll it up/down dragging it with the mouse) , you will see an edit mesh or edit poly modiifier. There, select face level (the quad or triangle icon, or click on the "+" up there, and choose "face")

-select all faces now ( ctrl a )

- you can scroll down the modifier till u see a thing called "surface" or something like that. There you will see a lot of numbered icons. Well, with all faces selected, hit the "clear all" (I think is the name) button, and then click on "1" button.

You must see now a non-golf ball.

if doesn't work, easier way, hit autosmooth with a value of "60", for example (type the number, and then hit the button at its left)

I'm speaking all from my memory now, though...


You need to export as OBJ, but this way smoothing normals can be lost... Obj exporter is at habware.at .

But probably, thenormals will get killed...you can try with x format. Try then panda exporter for max (a search in these forums, or better, in google)

or if not, here another x exporter few people seem to know of :


http://mofo.pns.to/snsp/?cmd=&mid=5
Finally making games again!
http://www.konekogames.com
FrSl
Posts: 19
Joined: Thu Jan 19, 2006 5:03 pm

Post by FrSl »

Thanks Vermeer! That was a good max tutorial for me. It was indeed a problem in the mesh.
You're help saved me a lot of time, or else i would have searched for this problem in the engine :roll: because without light the balls look smooth, so i was thinking of a wrong set flag somewhere. :P
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

good to hear that, am allways glad to help when time allows :)
Finally making games again!
http://www.konekogames.com
Silbermünze
Posts: 34
Joined: Thu Sep 15, 2005 12:27 pm
Location: Stuttgart, Germany

Post by Silbermünze »

Hello Vermeer!

Thanks first of all for the tips. I managed to get a sphere with a earth texture rendered "quite" smoothly after applying your Blender tips. Yet I experience differences when rendering the same scene in a .NET version of Irrlicht. See the below links to images of the two rendered earth spheres.

Unmanaged C++ DLL

Managed C# DLL



Even though I know this might better fit into the .NET forum, I wonder if you exeprienced anything in Irrlicht concerning triggering correct settings beside the above ones I mentioned?

I think it should render in the .NET version the same way, as the .NET DLL is only a wrapper, using the same base functionality as the C++ DLL.

After all I experienced I don't think it is only a problem ofthe model, as the most x-files I cretaed render smoothly in the DX-SDK x-file viewer, while they are rendered as shown in the image of my initial post from within Irrlicht.

Does anybody have an idea what might cause this?
Thanks in advance.

Silbermünze
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

sometimes opengl rendering make more normals darkening than dx rendering.

but anyway, if using same mesh, check that in the managed c# code, you aren't killing smoothing normals info, or just ignoring it, no counting on supporting it. Smoothing normals can be lost in any moment of the workflow 3d package-->engine.

I can't think of another thing...
Finally making games again!
http://www.konekogames.com
Post Reply