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

KaseiFox

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

115 Neutral

About KaseiFox

  • Rank
    Newbie
  1. Casting the matrix to a float3x3 will give you the same exact result as converting the normal to a float4 with a w-component of 0. @KaseiFox It's very hard to tell what's wrong with your image without knowing exactly how the object is being rotated, or how you're intending to rotating it. I would assume that you're changing rot.x, rot.y, and rot.z in some way each frame, so why don't you post that code as well?   Sure. I'm only changing rot.y, and the model itself rotates correctly, which is why I'm thinking there's something wrong with the normals being transformed. while(device->isRunning()) // is true until the window is closed { static float rot = 0.0f; rot += .003f; test->setRotation(EVector3(0, rot, 0)); // I've also tried using D3DXVECTOR3 to see if it was my vector class, but I get the same results. device->beginScene(.5f, .5f, .5f); // ClearRenderTargetView(), ClearDepthStencilView() (from device context) test->render(device, param); // model class, param contains view & projection matrices, along with light direction and color. device->endScene(); // IDXGISwapChain::Present() device->messageLoop(); // TranslateMessage(), DispatchMessage(), etc. }
  2. By this, he means that your calculations should be consistent. Both the normals and the light direction should lie in the same cooordinate frame/space. If you're transforming your normals to viewspace ( transforming them with the view matrix ) then you must also transform the light vector from world space to view space.  Your normals are in world space alright, but as c0lumbo said, make sure that your light vector is also in world space. Maybe you accidentally multiplied it with the view matrix? ( just guessing) The light direction isn't transformed by anything. I tried to transform the normals by a world*view matrix, and the light direction by both a world*view matrix and just a view matrix, but the same movement exists (although one time the light was a darker shade of grey, if that matters). I should also point out that I don't need to reverse the light direction, despite the fact that it's pointing in the wrong direction (towards the sphere, instead of away). I have no clue what's going on..
  3.   I've made those changes and get the exact same results :\     The actual value is just set once, as so:   out.lightDir = EV3Normalize(EVector3(1, -1, 1)); The cbuffer is set here:   if(FAILED(devcon->Map(lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) { loadedShaders = false; return false; } lbptr = (LightBuffer*)mappedResource.pData; lbptr->ambientCol = param.ambientCol; lbptr->diffuseCol = param.diffuseCol; lbptr->lightDir = param.lightDir; lbptr->padding = 0.f; devcon->Unmap(lightBuffer, 0); devcon->PSSetConstantBuffers(0, 1, &lightBuffer); When you said lighting is often done in viewspace, do you mean VSSetShader() and PSSetShader() are called once, then all objects are rendered? Because I'm only using the shaders this way so that different objects can get assigned different shaders for their respective materials. How would I go about 'combining' shaders if this is the case?
  4. I've implemented a directional lighting shader, and it works if the object if still, however, when rotated the light moves in an odd way. I keep thinking it's the normals, but I can't spot exactly what's wrong. I've attempted to make a GIF of my program below:     Snippet of my code setting the shader parameters:   ... D3DXMATRIX rotMat, posMat, worldMat; D3DXMatrixRotationYawPitchRoll(&rotMat, rot.y, rot.x, rot.z); D3DXMatrixTranslation(&posMat, pos.x, pos.y, pos.z); D3DXMatrixTranspose(&worldMat, &(rotMat*posMat)); D3DXMatrixTranspose(&param.viewMat, &param.viewMat); D3DXMatrixTranspose(&param.projMat, &param.projMat); if(FAILED(devcon->Map(matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) { loadedShaders = false; return false; } mbptr = (MatrixBuffer*)mappedResource.pData; mbptr->world = worldMat; mbptr->view = param.viewMat; mbptr->proj = param.projMat; devcon->Unmap(matrixBuffer, 0); devcon->VSSetConstantBuffers(0, 1, &matrixBuffer); ...   Snippet from vertex shader:   PixelInput LightVS(VertexInput input) { PixelInput output; input.pos.w = 1.0f; output.pos = mul(input.pos, mWorld); output.pos = mul(output.pos, mView); output.pos = mul(output.pos, mProj); output.tex = input.tex; output.norm = mul(input.norm, (float3x3)mWorld); output.norm = normalize(output.norm); return output; }   Snippet from pixel shader:   float4 LightPS(PixelInput input) : SV_TARGET { float lightIntensity = saturate(dot(input.norm, lightDir)); float4 col = ambientCol; if(lightIntensity > 0.0f) col += diffuseCol * lightIntensity; return saturate(col) * shaderTexture.Sample(sampleType, input.tex); } Thanks for any help.