OpenGL: Easiest way to make shadow and light Volumes? - opengl

I want to ask what is the easiest way to make shadow and light volume ? How can I bring to scene more realism? Do you know any nice tricks ? I hear that to make shadow i must use stencil buffer, but I don't know how:/ I can't find any super simple example how to make it.

There's no super simple way to do shadows. Sorry to disappoint you but shadows are one of the more complex problems in computer graphics, especially if they have to look good.
Now with that said here are some maybe helpful links for further reading:
The Theory of Stencil Shadow Volumes
Shadow Mapping with Today's OpenGL Hardware
Real-time Shadow Algorithms and Techniques
There's a simple example of shadow mapping in the NVIDIA SDK 9 here (Paper) which might be easy to adopt. There's also a section on shadows in all volumes of GPU Gems and a good overview in the Real-Time Rendering book (without code).

The Wolfire blog has had some good articles on shadows. Nothing too technical, no code samples, but to get a good overview of the concepts, they are great (and I love the pictures that always accompany the articles!).
Here is a full list of every article with "shadow" or "shadows" in the title. You may also choose to do a search on their blog for "shadow|shadows" to see every possible article, but beyond this list you probably won't find too much. Might also want to add "-alpha" so that you don't get any hits from their weekly alpha updates, which wouldn't have any worthwhile content.
2006/05/10: Starting shadows
2006/05/18: More shadows
2008/11/24: High-detail terrain shadows
2008/12/02: Object shadows
2009/03/29: Environment shadows - step 1
2009/04/03: Environment shadows - step 2
2009/04/07: Environment shadows - step 3
2009/04/10: Environment shadows - step 4
2009/11/13: Character shadows
2010/03/17: Two-part shadow maps
2010/04/19: Catching baked shadows
(list gathered 2010/05/19 by a google search for site:blog.wolfire.com intitle:shadow|shadows)

These questions are not easy to answer here, it'll require you some study and understanding of how graphic primitives works. However, there are some good sites over the web you can take a look, like Nehe and GameDev. There are lots of articles and tutorials there, just take some time to search and read them. There is also some rendering engines that you can use that will do a lot of nice things for you, like Ogre3d and Irrlicht but if you cant understand the principles behind them (like shadows, illumination...), I recomend you to try in OpenGL first, learn it, and then use some engine to get the work done for you.

In addition to the other useful sources mentioned here, you should consider getting an introductory text on linear algebra, or Eric Lengyel's excellent Mathematics for 3D Game Programming and Computer Graphics, Second Edition. Computer graphics are made of math, and at some level it gets really hard to implement things out of a cookbook without some understanding of the underlying algebra.

Related

Global illumination for static geometry

I have been trying to find a suitable global illumination technique, preferably based on OpenGL or GPGPU, to light an outdoor scene which has static objects and dynamic light sources (it is a city model). It does not need to be very detailled or accurate, but it should be rather simple and if possible, iterative and refining (so I can display the intermediate results).
The best matches I found on the internet is Ray tracing, Precomputed Radiance Transfer(PRT) and Radiosity.
Ray tracing will be far too slow for my application. PRT seems to be too complex and has a huge precomputation step, and radiosity seems too slow and I am not sure if it can be implemented multi threaded.
Does anyone know a better technique, or a workaround of the above problems?
In terms of a more realistic and usable approach than svoGI (Crassin's voxel technique), you might consider deferred irradiance volumes, there is a great webGL demo with full source available here, its based around using spherical harmonics.
There are also older techniques like LPV, which you can check out here, here and here.
Yes, this question is old, but people might still stumble upon it.
How about "Voxel Cone Tracing"?
The Unreal Engine 4 implements it and they also described the algorithm in a presentation.
http://www.unrealengine.com/files/misc/The_Technology_Behind_the_Elemental_Demo_16x9_%282%29.pdf

OpenGL rotating textured planes in 3D space

I'm wondering if anyone could point me to any resources that would deal in rotating one or several 2D textured planes in 3D space. Something like this but with openGL (preferably C++):
I'm attempting to do pretty much the exact same thing but no matter how I order my operations I'm getting right-screwy results. So I figure asking for some resources on the subject is better than posting tons of code and asking for people to fix my problems for me. :)
If you havent already, do a search for 'NeHe tutorials'. An excellent set of OpenGL tutorials.
Here is a link to the rotation tutorial, includes all the source code in downloadable format and the tutorial walks you through each relevant line.
http://nehe.gamedev.net/tutorial/rotation/14001/
I believe this is working in a 2D space, the step up to 3D probably involves a bit more matrix math but...doable
The NeHe tutorials are a very popular place to learn the basics of OpenGL. In particular, the tutorial about texture mapping should help you:
http://nehe.gamedev.net/tutorial/texture_mapping/12038/
Mind you though that these tutorials are written for older OpenGL versions which are more beginner friendly IMHO.
You should look into scene graphs. Basically it is a way to define a bunch of objects (2D textured planes) and their transforms in 3D space. This allows you to define transforms that work on multiple nodes (objects) as well as single nodes. You can make a pretty simple one in C++ with little effort, or use one such as OpenSG or OSG (slight learning curve needed).
Wikipedia - http://en.wikipedia.org/wiki/Scene_graph

3D effects description book

I was wondering around google and found nothing good for 3D effects such as bump map, parallax mapping, etc. Please help me with this, is there a book which describes different ways to achieve such effects? furthermore if the book has opengl samples for the algorithms it would be much better.
I've enjoyed Real-Time Rendering. When I wrote my 3D engine everything I needed to know was contained in that book.
http://www.realtimerendering.com/book.html
The GPU Gems series of books comes to mind. Also available online at the NVidia developer webside.

Finding the right tools for programming a futuristic-styled UI project

I've always been inspired by dynamic, futuristic-like user interfaces. The best I can describe is a graphic interface such as in the latest Iron Man movies.
Although I wouldn't build a full blown application, I would like to make little snipplets of animations that I plan to make interactive. And maybe put them together someday to make something bigger. Admittedly, I will use for audio manipulation in the future but anyway, that's not the point since it's the animations/graphics I'm unsure of.
I know it's possible to make those kind of animations in Adobe After Effects. I'm just having a hard time thinking of the processes (artistically and programmability) to proceed.
While researching on this on my own I have acquired basic experience with OGRE 3D and Blender. I've imported and compiled meshes on OGRE, have been able to do basic things like move the meshes around which is about it.
I'm beginning to think I may be approaching this the wrong way and there are better tools or if 3D is overkill for those kind of animations when 2D would suffice and maybe provide a smoother experience.
I'm having trouble understanding the process and am wondering two things:
1.)The main thing I'm having trouble understanding is how to get still graphics to make animations? Do the meshes keep the timeline from a program like Blender then a graphics engine like OGRE reads the timeline and plays them?
Most importantly:
2.)Do I even need graphics (meshes)? Most of the interface are thin-border boxes, text and shapes of transparent LED-like colors that can move around dynamically to make that futuristic effect.
Please share your opinions, suggestions and anything you think might help me accomplish to develop those kinds of sexy eye candy! Thanks.
When you look at awesome futuristic UIs in movies, they are usually made of
basic primitives
desaturated colors, and/or one color tone
transparency
a cool font or two
high-tech text, graphs or similar
simple animations to make things look "alive", blinking lights/text and similar
a touch interface, of course
Maybe you can't do a lot about the touch interface, but the rest is really not hard graphics wise, it's a matter of carefully crafted artwork and combining simple elements in a cool way.
Also I would look into Adobe Photoshop and fancy texturing rather than Blender and fancy modelling, as you are looking for a fancy 2D UI, and detailed 3D models will not be that important. Playing around in photoshop (well, or GIMP if you want a free alternative) can help you develop your art skills, and help you get that high-tech, sci-fi look on a 2D surface.
You know, I would go as far as to suggest making some sci-fi wallpapers in the style you are after before trying to solve this problem in code. I think you will find that photo manipulation skills and an eye for art will help you here. And for gods sake, look at those movies (Iron Man, Minority Report etc.) that have those UIs you are aiming at, and analyze what exactly they are. Decompose them like I did in the list above.
As for the "which tools should I use?", I say the answer to that is fairly simple:
OpenGL
Photoshop (or GIMP if you are a starving student etc.)
A compiler & toolchain
A code editor/IDE
A cup
I see this is tagged C++, which is an excellent choice of programming language if I may say so.
Ogre is a full blown 3D engine, which is fine, but not exactly targeted at what you want to use it for. You might find that you struggle to get what you want done (disclaimer: I have not tried this in Ogre, and it might work well for this. Then again, when did you last see Ogre used in an audio manipulation program?). My advice is to learn good, simple OpenGL. That would give you complete power over your UI, not get in your way or limit you in any way. It is also cross platform, well documented, and used by tons of developers all over the world (also for audio manipulation applications). I can't see how you could possibly go wrong with it. The fun part is that it probably won't take you long to get advanced enough in it to start developing some pretty nice UIs. As I mentioned, it's more of an art problem than a coding problem.
The cup is for the coffee, by the way. :)
The easiest and most efficient way is to keep track of all your graphics data (meshes, animations, effects) in "media files" and load & play them in runtime. Though you'll be able to easily change your game without changing the code.
For example, you have a Diablo-like game and you wanna turn it to the future-style. You just need to rewrite some player and AI scripts and modify meshes/effects/sounds/animations. But if you've done those via code - it will be a new game from scratch.
I would suggest Ogre, but you already used that, so by my opinion, you are on the right track.
Look up 'billboards' in Ogre documentation, re: LED and 2D stuff.

Creating effects in 3D game from scratch, using c++ and DirectX

So the title says it. I couldn't find any info on how actualy build effects into 3D game. I'll maybe stick to some engine later, but for understanding of this whole thing I would need to try it on my own for this time. I found a few about particle systems which may be the right way but any other connection between DirectX and particle systems on google gave results as 3DSmax and etc.
So I would be thankful if you would point me on some tutorials for this, or explaining it...
Last possibilitie would be pointing me on some simple engine focused on this thing (I don't really want to fight through tons of code and understanding how this engine works, I just need to see how they implement this FX stuff).
Thanks
PS: the other possibilitie would be if you know about good book discusing this. It can be more complex but apart from tutorial, books are usually wrote more basicly so this would be also nice way to go
First of all: particle effects are just one kind of effects, it's better you specify the word particle engine :p.
Secondly: search int he articles of Gamedev, it's really the best resource if you want things like this. You can find lots of articles and even better, tons of links, and useful information on the discussion boards. Two articles I can link to is the NeHe lesson about particles in OpenGL, it's not directx but NeHe tutorials for OpenGL are very good. I also found one for directx8 and VB (so a little bit older).
Keep in mind though that a particle engine is often a huge performance hit if you can't optimize it yourself, so try to look at open source game engines (e.g. OGRE) on how they implement it or even better, specific particle engines.
So I would be thankful if you would point me on some tutorials for this
You need to download microsoft DirectX SDK.
In addition to it, you should try NVidia SDK.
You may also try ATI SDK. Study them all.
In addition to them... there are couple of books on OpenGL: "Red Book", "Blue Book", Orange Book . "Computer graphics using OpenGL" by Francis Hill is also a very good one.
Get this info, and start reading.
how actualy build effects into 3D game
This question is too broad. There are lighting effects, particle systems, post-processing effects, physics (which are also effects), and even character animation is an effect. It is unclear what kind of effects you are talking about.
What do you think is better DirectX or OpenGL.
They are more or less equal. You can do same things in both of them. Try both and pick one you liked more. OpenGL is better for playing around and experimenting (because you can easily draw triangle without messing with hardware buffers), available on larger selection of platforms, plus GLSL is better than HLSL (because it doesn't "compile into assembly"). DirectX is geared towards performance from the beginning, available on XBox360, and 9th version was actually good. openGL is more "abstract" and DirectX is closer to hardware.
If you could use the factors as simplicity, area of usage, performance, number of examples and resources etc
If you want simplicity, you should forget about making game engine. You'll have to learn quite a lot of things if you want to deal with 3D.
Both DirectX and OpenGL are used for making 3d-related products.
You can get good performance with both DirectX and OpenGL, and get poor performance if you don't know what you're doing.
Both DirectX and OpenGL have insane amount of examples and books - just search for it. They weren't made yesterday, so enough information is already available.
You need to select goal, select platform, select your API, research available technologies, and start writing code. Wondering "which one is better" is a waste of time. 3D knowledge and algorithm are equally applicable to both APIs.
OpenGL is the best bet to learn I feel. Glut is available free of cost and has all the functions you need to implement a particle engine. Plus theres loads of sample code online. I like the way functions are . Easy to remember and use logically
The best books for learning D3D9.0c/D3D10 are by Frank Luna. Just put him in to amazon or google and you'll get results. He teaches how to build a fully-fledged game engine from scratch.