• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
jenny_wui

Need urgent help for camera traversal

7 posts in this topic

Hello, I need urgent help. I have extracted medial axis of intestine model. Now I need view the inside of the  intestine. I have a number of points which form the path. Now for camera I choose the first point of the path and second point as the center for gluLookAt function. But I cannot see any thing, I only see black background. How can I view the inside of my model. Please help me. I have attached picture of both the model and the traverse path. I have showed the camera and center position. Thanks in advance.

0

Share this post


Link to post
Share on other sites

You need to disable culling. It's doing either CCW or CW culling but if you want to see both sides it needs to be disabled.

0

Share this post


Link to post
Share on other sites

Culling is already disabled in my code. Here is a part of my initGL code:

 

/***************************************************/

 

void initGL(){

 

static const GLfloat light_model_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f};

static const GLfloat light0_diffuse[] = {0.9f, 0.9f, 0.9f, 0.9f};

static const GLfloat light0_direction[] = {0.0f, -0.4f, 1.0f, 0.0f};


 

// Enable depth buffering for hidden surface removal.

 

glDepthFunc(GL_LEQUAL);

glEnable(GL_DEPTH_TEST);

 

// Cull back faces.

 

glCullFace(GL_BACK);

glDisable(GL_CULL_FACE);

 

// Setup other misc features.

 

glEnable(GL_LIGHTING);

glEnable(GL_NORMALIZE);

glShadeModel(GL_SMOOTH);

 

 

// Setup lighting model.

 

glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);

glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);

glLightModelfv(GL_LIGHT_MODEL_AMBIENT, light_model_ambient);

glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);

glLightfv(GL_LIGHT0, GL_POSITION, light0_direction);

glEnable(GL_LIGHT0);

}

/************************************************************/

 

I don't understand where the problem is. Please help me identify it. Thanks

 

 

0

Share this post


Link to post
Share on other sites

I made some mistake. I can see something like theattached picture when I correct my coding:

 

// Cull back faces.

glCullFace(GL_FRONT_AND_BACK);

glDisable(GL_CULL_FACE);

 

 

 

But I would like to see the only things along the direction from camera to center as shown my earliest posting i.e. inside the organ.

 Do I need to do some thing with up vector in my gluLookAt function?

 

Also I have question: my camera is at  the begining of the path as shown in the picture of my earliest posting. Why do I see that point when my camera is already set there? Please help me clarify it. 

0

Share this post


Link to post
Share on other sites

Now I am getting some output by setting camera at v0 and center at v2 by adjusting near and far plane in gluPerspective (last time it was too away from camera).  I have attached the output.

 

But the result is not ok, I want to see the image centered, but I am getting it partially. As I keep on moving by pressing a key making the center point as camera and center as the next vertex, the output is worse. sometimes ou of the model. I understand I need to finetune  the alignment between v0v1 and v1v2 and so on. Please give me some suggestion.[attachment=13221:model3.png]

 

0

Share this post


Link to post
Share on other sites

I think you'll want to keep messing with the frustum a bit. The intestine model is still piercing the near plane. There are basically two parameters that you can play with (assuming you're using gluPerspective or something similar): your fovy and your near plane distance. If your intestines have a radius of r, then you'll want to make sure that:

 

a * n * tan(fovy) < r

 

Where n is your near plane value, and a is your aspect ratio. You may also want to give yourself a buffer of 10% or so, just in case. So, either your n or your fovy (or both) need to be smaller. It may help to play with these two parameters until you like what you see. Making the fovy smaller will create a "zoom in" effect that you may or may not like. Making the near plane distance smaller will keep the same view, more or less, but you may eventually run into depth-buffer-precision issues if you make it small enough (if so, it's easy to fix...just bring your far plane closer). 

 

As far as why it is off-center, since you are using a symmetrical frustum, it's likely that your eye and center points are off. If your "center" point were accurate, then we should see the medial axis run right through the center of the screen. Since we don't do that, there may be a problem with the method you are using to calculate points on this axis.

 

Edit: Although, I'm assuming here that the "center" point isn't being clipped by the near plane. Try making your near plane way smaller to fix your clipping issues, and then see if that solves your centering issues. Also, make sure that your viewport correctly matches the size of your window; if your viewport is too large, it can cause things to look off-center. If you know that your eye/center points are accurate and that your viewport is correct, then the last thing I would try is using a "center" point that is much closer to your "eye" point, albeit still on your median axis curve, so as to create a better approximation of the curve's tangent.

 

Edit5: Typos (it's late).

Edited by CDProp
0

Share this post


Link to post
Share on other sites

Thank you very much for the help.Now when I move, I find the camera in the middle of the screen, by adjusting fovY and near plane. But most of time I could see side, roof or floor of the tunnel as shown in my first picture, very few times, I can see the whole boundary as shown in the second picture. How can that be adjusted?

 

 

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0