Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

point me to the next step please~

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 lululoo   Members   -  Reputation: 116


Posted 18 May 2012 - 03:50 AM

I recently began learning opengl in hopes of making a game for fun. So far, I've gotten a working third person camera system with working models (meh, only obj models so far.. another time though), and I've almost got textures working. With textures, I understand that I can design a skybox, and with that, I would be able to create an environment with a working player model with moving parts based on the camera, with a working skybox and various landscapes spread throughout in a small radius.

Now.. I'm kind of lost. I don't quite understand how I can now have my player model interact with terrain (i.e. don't let the player walk right through the model of the wall lol). I'm not sure how / what lighting/shading are.. and I don't even know what I don't know from that point.

So if you could, point me in the right direction with info / links please~ thank you.


#2 Waterlimon   Crossbones+   -  Reputation: 2598


Posted 18 May 2012 - 05:56 AM

Well, for physics you usually have a different representation that for the mesh. So that each object is a mesh + lets say a simpler mesh for collisions. Then you would do the physics on the meshes/shapes representing the physical form of the object (for example handling the character as a sphere and if it goes inside the terrain, move him up a bit, if he tries to move into walls, move him back...)


#3 freakchild   Members   -  Reputation: 557


Posted 18 May 2012 - 12:55 PM

To prevent a character from walking through a wall you will want to develop collision detection and response functionality. It's doesn't have to be 'physics' as such - it can just be a case of mathematics to detect the collision and then to calculate the correct position the character should be in had the character not walked through the wall. A modern game will do much more than this, including adding more physics calculations in but this is how games generally were once upon a time and it's best to start out simple.

The simplest form would be to consider a point where the characters feet are and how (when the character moves) the two places this point moves between form a line. From there, line vs polygon intersection tests will detect the collision and help you figure out how to correct. This is very basic...you'll partially clip through walls, floors and there’ll be a whole load of other problems but it’s simple and outlines simple principles that a more advanced solution solves on a larger scale.

A more elaborate implementation would be something like http://www.paulnettl..._Ellipsoids.pdf which would take you to a more advanced level without things getting too complex. Again, this would be somewhat representative of a common technique used in games and and I once put this exact thing into a PS2 game.

But I don’t bring this up for the purposes of a history lesson, its more the case that I think this paper describes a number of concepts and considerations that you might be interested in. Certainly if you read that paper you’ll begin to get a greater understanding of the many things involved with moving a character around and you'll begin to appreciate many small concepts that are still relevant in even more advanced solutions.

As for that more advanced solution…most people do solve this via general purpose physics engines nowadays. You can author your own but libraries like bullet physics might also interest you if you don’t want to do that.

Edited by freakchild, 18 May 2012 - 01:37 PM.

#4 freakchild   Members   -  Reputation: 557


Posted 18 May 2012 - 01:19 PM

As for lighting and shading, the meaning of these words can vary from slight to wild depending on the context.

In my own words generally shading is the variation and/or coloring of pixels. If you took some coloring pens and filled in a picture with color, you would be shading it. In the computer graphics sense though, it really means working out which pens/colors to use according to calculations or techniques that would be based on the physical properties in the scene or special visual effects. Some of those calculations might include considering the position and features of lights and coloring those pixels as if they were being lit by those lights …that’s what lighting is. There are many ways to do lighting and many different techniques.

Some people might argue that shading is to do with authoring ‘shader programs’. It is…but given that we also did shading before the concept of shader programs existed its more to do with the techniques and methods that we use to make scenes look more realistic or unrealistic, depending on the desired effect.

You can see a lot of different basic types of shading effects @ http://www.paulsproj.../projects1.html under the open gl projects topics. Note that some of these involve lighting.

If you want to get started in lighting, then bear in mind that by texturing you’ve already taken the first steps of what is known as lighting via a diffuse texture. The next steps would likely be learning about directional light (which is more of an effect than anything that exists in real life) and positional lights and figuring out how to account for them in your scene.

It’s an older reference, but I’ve always found the Cg book lighting chapter http://developer.nvidia.com/node/88 to be one of the best descriptions of the very basic lighting techniques and equations. The book in itself is a good reference for much of the basics involved in lighting and authoring shader programs, which you'll need to know if you want to tread this path.

Edited by freakchild, 18 May 2012 - 01:22 PM.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.