• 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.
afraidofdark

OpenGL
Quake3 ambient lighting

8 posts in this topic

I have just noticed that, in quake 3 and half - life, dynamic models are effected from light map. For example in dark areas, gun that player holds seems darker. How did they achieve this effect ? I can use image based lighting techniques however (Like placing an environment probe and using it for reflections and ambient lighting), this tech wasn't used in games back then, so there must be a simpler method to do this.

Here is a link that shows how modern engines does it. Indirect Lighting Cache It would be nice if you know a paper that explains this technique. Can I apply this to quake 3' s light map generator and bsp format ?

0

Share this post


Link to post
Share on other sites

And also I think the bot/opponents are being shadowed in the darker areas of the map, although it's harder to tell because they move around very quickly, and also the dynamic lights are lighting them up when they fire their gun at you.

0

Share this post


Link to post
Share on other sites

Lots of games from that era would trace a single ray downwards to find the floor under the player's feet, then find the lightmap-UV coordinates at that point, then sample the lightmap at those coordinates and use it as a constant ambient value for the player.

2

Share this post


Link to post
Share on other sites
On 15.07.2017 at 4:39 PM, Hodgman said:

Lots of games from that era would trace a single ray downwards to find the floor under the player's feet, then find the lightmap-UV coordinates at that point, then sample the lightmap at those coordinates and use it as a constant ambient value for the player.

Increasing sample count and applying attenuation based on distance may produce a good result. I'll definitely give this a shot.

One of my question remained unanswered. How modern engines does this ? Is there a paper, tutorial or a chapter from a book that explains ue4's light cache or Unitiy's light probe ? Before implementing anything I like to know about this.

0

Share this post


Link to post
Share on other sites
10 hours ago, afraidofdark said:

One of my question remained unanswered. How modern engines does this ? Is there a paper, tutorial or a chapter from a book that explains ue4's light cache or Unitiy's light probe ? Before implementing anything I like to know about this.

Here are some options how to store directional ambient light, any of them can be called 'probe':

 

One color for each side of a cube, so 6 directions and you interpolate the 3 values fitting a given normal. (Known as Valves ambient cube used in HL2)

Spherical Harmonics. The number of bands you use define the detail, 2 or 3 bands (12 / 27 floats) is enough for ambient diffuse.

Cube maps. Enough details for reflections (used a lot for IBL / PBR today). Lowest LOD == ambient cube.

Dual paraboloid maps (or two sphere maps). Same as cube maps, but needs only 2 textures instead 6.

 

Independent of the data format you choose there remains the question how to apply it to a given sample position. some options:

 

Bounding volume set manually by artist, e.g. a sphere or box with a soft border: You find all affecting volumes per sample and accumulate their contribution.

Uniform grid / multiresolution grids: You interpolate the 8 closest probes. E.g. UE4 light cache.

Voroni Tetrahedronilaztion: You interpolate closest 4 probes (similar to interpolating 3 triangle vertices by barycentric coords for the 2D case). AFAIK Unity uses this.

 

Also the automatic methods often require manual tuning, e.g. a cut off plane to prevent light leaks through a wall to a neighbouring room.

Notice a directionless ambient light used in Quake does not support bump mapping. The 'get ambient from floor' trick works well only for objects near the ground.

There are probably hundrets of papers talking about details.

2

Share this post


Link to post
Share on other sites
On 7/16/2017 at 8:00 PM, afraidofdark said:

Increasing sample count and applying attenuation based on distance may produce a good result. I'll definitely give this a shot.

One of my question remained unanswered. How modern engines does this ? Is there a paper, tutorial or a chapter from a book that explains ue4's light cache or Unitiy's light probe ? Before implementing anything I like to know about this.

The "get ambient from floor" only applies to Quake 2 (and possibly Quake 1). Quake 3 uses a 3D grid, each cell contained 3 values: Direction, Ambient light color, and Direct light color. This data is filled during lightmap baking.

The grid is bound to the levels bounding box and divided by some value (default is xyz: 64,64,128). That is, each cell ranges 64 units in XY and 128 on Z (which is up in Quake).

 

Modern games do largely the same thing, however they store the results in different forms (spherical harmonics, whatever else). JoeJ covers this in the post above.

For ambient diffuse, a variation of the things JoeJ can be seen in modern engines, each with their own tradeoffs. For ambient reflections, cubemaps are used, often times hand-placed.

Edited by Styves
1

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

  • Similar Content

    • By Solid_Spy
      Hello, I have been working on SH Irradiance map rendering, and I have been using a GLSL pixel shader to render SH irradiance to 2D irradiance maps for my static objects. I already have it working with 9 3D textures so far for the first 9 SH functions.
      In my GLSL shader, I have to send in 9 SH Coefficient 3D Texures that use RGBA8 as a pixel format. RGB being used for the coefficients for red, green, and blue, and the A for checking if the voxel is in use (for the 3D texture solidification shader to prevent bleeding).
      My problem is, I want to knock this number of textures down to something like 4 or 5. Getting even lower would be a godsend. This is because I eventually plan on adding more SH Coefficient 3D Textures for other parts of the game map (such as inside rooms, as opposed to the outside), to circumvent irradiance probe bleeding between rooms separated by walls. I don't want to reach the 32 texture limit too soon. Also, I figure that it would be a LOT faster.
      Is there a way I could, say, store 2 sets of SH Coefficients for 2 SH functions inside a texture with RGBA16 pixels? If so, how would I extract them from inside GLSL? Let me know if you have any suggestions ^^.
    • By MarcusAseth
      I am watching at this page -> https://msdn.microsoft.com/en-us/library/windows/desktop/dd371301(v=vs.85).aspx
      HRESULT CreateStrokeStyle( [ref] const D2D1_STROKE_STYLE_PROPERTIES &strokeStyleProperties, [in, optional] const FLOAT *dashes, UINT dashesCount, [out] ID2D1StrokeStyle **strokeStyle ); notice the second optional argument followed by two non-optional ones...how in the world am I supposed to use the function without passing the second argument, if it is on the middle?! x_x
    • By MarcusAseth
      I have this Direct2D framework set up, it render a constant 60FPS and this is my code in my draw call:
      mRenderTarger->Clear(D2D1::ColorF(0.41f, 0.41f, 0.41f, 1.0f)); GetCursorPos(&mMouse); ScreenToClient(mhWindow, &mMouse); D2D1_POINT_2F point2 = D2D1::Point2F(mMouse.x, mMouse.y); //wrapper function of the Direct2D FillEllipse function drawPoint(point2, 6.f, D2D1::ColorF(1.0f, 0.15f, 0.30f, 1.f)); Now even without moving the mouse too fase, the point drawn kind of lag behind a bit, and moving the mouse faster, the point is drawn as far as 5cm from my mouse cursor so the lag is visible.
      Any idea why this accurs and how to fix it? 
    • By MarcusAseth
      Hi guys, I'm trying to build my 3x3 rotation matrix algorithm for the sake of thoroughly understand it as much as I can
      The code below is what I just wrote from memory in an attempt to explain it to myself and test what I understand and what I do not.
      I roughly start to get it (saw it last week for the first time and kind of crashed my soul, at the time) and if I decompose it in small single pieces as I did below, it actually works and my point is being rotated to the appropriate coordinates (or almost, since the y component ends up getting 0ed out, so I think I just need to add back the p_proj_to_rA Vector to the final resoult to have it right).
      This being said, I completely missed the point of building a rotation matrix out of it, even though the whole time I was convinced to be moving toward the goal 
      I mean I've made my matrix class with all the relevant operations/methods, but I just don't know how to do the final step to convert what I have below into a rotation matrix...and I do not mean the fomula, which I have in the book and I can copypaste that and have it work if I want to, what I need is to actually see how to derive that final matrix formula from what I have below, I need to understand how it correlate in a way that if I where to reason about the final rotation matrix formula in the book I could say "of course, it's obvious".
      So everyone that deeply understand rotation matrix and how to end up with one(without just copy-pasting the formula from a book or using a function that just give you one) is welcome to take on the challenge of making it look obvious to me, so that I can finish my program and end up with the correct one for wathever Axis of rotation I choose 
      Or just link me wathever online resource helped you in the past
      Thanks
       
      Vector p = { 1, 1, 1 };// point that needs to rotate Vector rA = { 0, 1, 0 }; // rotation Axis p.computeMagnitude(); // sqrt( x*x + y*y + z*z ) rA.computeMagnitude();// sqrt( x*x + y*y + z*z ) //projection of our point on the rotation axis, which corresponds to the dotProduct since rA is of lenght 1 // Formula 1 dotProduct(p,rA) = px*rAx + py*rAy + pz*rAz // Formula 2 dotProduct(p,rA) = |p| * |rA| * cos(angleBetween) // proj_rA(p) = dotProduct(p,rA) = |p| * 1 * cos(angleBetween) = |p| * cos(angleBetween) //Solve Formula 2 for angleBetween //|p| * cos(angleBetween) = dotProduct(p,rA) // cos(angleBetween) = (dotProduct(p,rA) / |p|) // angleBetween = acos( dotProduct(p,rA) / |p| ) // proj_rA(p) = |p| * cos(angleBetween) // proj_rA(p) = |p| * cos( acos( dotProduct(p,rA) / |p| ) ) //projection of p on rA: double proj_to_rA = p.magnitude * cos(Vector::angleBetween(p, rA)); //vector p projected on rA, which is basically a longer or shorter version of rA Vector p_proj_to_rA = rA * proj_to_rA; //subtracting from p the (projection of p on rA) zeroes out the dotProduct(p,rA) so the resulting vector must be orthogonal to rA Vector p_perp_to_rA1 = p - p_proj_to_rA; //the cross product between two vector is a vector orthogonal to both of them //Formula 1 crossProduct(A,B) = |A|*|B|*sin(angleBetween) //Formula 2 v1.y*v2.z - v1.z*v2.y, //X // v1.z*v2.x - v1.x*v2.z, //Y // v1.x*v2.y - v1.y*v2.x //Z Vector p_perp_to_rA2 = Vector::crossProduct(rA, p_perp_to_rA1); //since rA, p_perp_to_rA1 and p_perp_to_rA2 are all perpendicular to each other, //if we now only consider p_perp_to_rA1 and p_perp_to_rA2 they describe a 2d plane //perpendicular to rA, and we rotate stuff based on this plane //Now the desired point of that plane is the sum (VectorX on p_perp_to_rA1 + VectorY on p_perp_to_rA2) double desiredRotation = toRad(-30); double X = cos(desiredRotation); double Y = sin(desiredRotation); Vector finalPoint = Vector(p_perp_to_rA1 * X) + Vector(p_perp_to_rA2 * Y); cout << "x,y,z{ 1, 1, 1 } -30 degree on the x,y,z{ 0, 1, 0 } Axis = " << finalPoint << endl; return 0; output:
       
  • Popular Now