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

gder

Members
  • Content count

    6
  • Joined

  • Last visited

Community Reputation

122 Neutral

About gder

  • Rank
    Newbie
  1. It seems mixed together in some vertex, see the attachement!   I modifiedsource code from  http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html Because they use glsl4.1,  can't run my computer!   Thanks!   code snippet in mesh.cpp  Mesh::InitFromScene:         glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[POS_VB]);     glBufferData(GL_ARRAY_BUFFER, sizeof(Positions[0]) * Positions.size(), &Positions[0], GL_STATIC_DRAW); int VSInput_Position = glGetAttribLocationARB (g_shaderProg, "VSInput_Position"); glEnableVertexAttribArray(VSInput_Position);     glVertexAttribPointer(VSInput_Position, 3, GL_FLOAT, GL_FALSE, 0, 0);         glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[TEXCOORD_VB]);     glBufferData(GL_ARRAY_BUFFER, sizeof(TexCoords[0]) * TexCoords.size(), &TexCoords[0], GL_STATIC_DRAW); int VSInput_TexCoord = glGetAttribLocationARB (g_shaderProg, "VSInput_TexCoord");     glEnableVertexAttribArray(VSInput_TexCoord);     glVertexAttribPointer(VSInput_TexCoord, 2, GL_FLOAT, GL_FALSE, 0, 0);        glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[NORMAL_VB]);     glBufferData(GL_ARRAY_BUFFER, sizeof(Normals[0]) * Normals.size(), &Normals[0], GL_STATIC_DRAW); int VSInput_Normal = glGetAttribLocationARB (g_shaderProg, "VSInput_Normal");     glEnableVertexAttribArray(VSInput_Normal);     glVertexAttribPointer(VSInput_Normal, 3, GL_FLOAT, GL_FALSE, 0, 0);        glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[BONE_VB]);     glBufferData(GL_ARRAY_BUFFER, sizeof(Bones[0]) * Bones.size(), &Bones[0], GL_STATIC_DRAW); int VSInput_BoneIDs = glGetAttribLocationARB (g_shaderProg, "VSInput_BoneIDs");     glEnableVertexAttribArray(VSInput_BoneIDs);     glVertexAttribPointer(VSInput_BoneIDs, 4, GL_INT, GL_FALSE,  sizeof(VertexBoneData), (const GLvoid*)0); int VSInput_Weights = glGetAttribLocationARB (g_shaderProg, "VSInput_Weights");     glEnableVertexAttribArray(VSInput_Weights);         glVertexAttribPointer(VSInput_Weights, 4, GL_FLOAT, GL_FALSE, sizeof(VertexBoneData), (const GLvoid*)16);          glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_Buffers[INDEX_BUFFER]);     glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices[0]) * Indices.size(), &Indices[0], GL_STATIC_DRAW);     vertex shader:   #version 110 attribute  vec3  VSInput_Position;                                              attribute  vec2  VSInput_TexCoord;                                              attribute  vec3  VSInput_Normal;     attribute  vec4 VSInput_BoneIDs; attribute  vec4  VSInput_Weights; varying    vec2 VSOutput_TexCoord;      varying    vec3 VSOutput_Normal; varying    vec3 VSOutput_WorldPos;      const int MAX_BONES = 100; uniform mat4 gWVP; uniform mat4 gWorld; uniform mat4 gBones[MAX_BONES]; void main() {            mat4 BoneTransform = gBones[int(floor(VSInput_BoneIDs[0]))] * VSInput_Weights[0];     BoneTransform     += gBones[int(floor(VSInput_BoneIDs[1]))] * VSInput_Weights[1];     BoneTransform     += gBones[int(floor(VSInput_BoneIDs[2]))] * VSInput_Weights[2];     BoneTransform     += gBones[int(floor(VSInput_BoneIDs[3]))] * VSInput_Weights[3];     vec4 PosL      = BoneTransform * vec4(VSInput_Position, 1.0);     gl_Position    = gWVP * PosL;     VSOutput_TexCoord = VSInput_TexCoord;     vec4 NormalL   = BoneTransform * vec4(VSInput_Normal, 0.0);     VSOutput_Normal   = (gWorld * NormalL).xyz;     VSOutput_WorldPos = (gWorld * PosL).xyz;                                 }   fragment shader:   #version 120 struct VSOutput {                                                                                         vec2 TexCoord;                                                                      vec3 Normal;                                                                        vec3 WorldPos;                                                                  }; struct VSOutput1 {                                                                                         vec2 TexCoord;                                                                      vec3 Normal;                                                                        vec3 WorldPos;                                                                  }; const int MAX_POINT_LIGHTS = 2; const int MAX_SPOT_LIGHTS = 2; struct BaseLight {     vec3 Color;     float AmbientIntensity;     float DiffuseIntensity; }; struct DirectionalLight {     BaseLight Base;     vec3 Direction; };                                                                                      struct Attenuation                                                                   {                                                                                        float Constant;                                                                      float Linear;                                                                        float Exp;                                                                       };                                                                                                                                                                        struct PointLight                                                                            {                                                                                                BaseLight Base;                                                                       vec3 Position;                                                                               Attenuation Atten;                                                                       };                                                                                                                                                                                        struct SpotLight                                                                             {                                                                                                PointLight Base;                                                                      vec3 Direction;                                                                              float Cutoff;                                                                            };                                                                                                                                                                                        uniform int gNumPointLights;                                                                 uniform int gNumSpotLights;                                                                  uniform DirectionalLight gDirectionalLight;                                                  uniform PointLight gPointLights[MAX_POINT_LIGHTS];                                           uniform SpotLight gSpotLights[MAX_SPOT_LIGHTS];                                              uniform sampler2D gColorMap;                                                                 uniform vec3 gEyeWorldPos;                                                                   uniform float gMatSpecularIntensity;                                                         uniform float gSpecularPower; vec4 CalcLightInternal(BaseLight Light, vec3 LightDirection, VSOutput1 In)             {                                                                                                vec4 AmbientColor = vec4(Light.Color, 1.0f) * Light.AmbientIntensity;                        float DiffuseFactor = dot(In.Normal, -LightDirection);                                                                                                                                       vec4 DiffuseColor  = vec4(0, 0, 0, 0);                                                       vec4 SpecularColor = vec4(0, 0, 0, 0);                                                                                                                                                    if (DiffuseFactor > 0) {                                                                         DiffuseColor = vec4(Light.Color, 1.0f) * Light.DiffuseIntensity * DiffuseFactor;                                                                                                          vec3 VertexToEye = normalize(gEyeWorldPos - In.WorldPos);                                      vec3 LightReflect = normalize(reflect(LightDirection, In.Normal));                              float SpecularFactor = dot(VertexToEye, LightReflect);                                       SpecularFactor = pow(SpecularFactor, gSpecularPower);                                        if (SpecularFactor > 0) {                                                                        SpecularColor = vec4(Light.Color, 1.0f) *                                                                    gMatSpecularIntensity * SpecularFactor;                                  }                                                                                        }                                                                                                                                                                                         return (AmbientColor + DiffuseColor + SpecularColor);                                    }                                                                                                                                                                                         vec4 CalcDirectionalLight(VSOutput1 In)                                                       {                                                                                                return CalcLightInternal(gDirectionalLight.Base, gDirectionalLight.Direction, In);   }                                                                                                                                                                                         vec4 CalcPointLight(PointLight l, VSOutput1 In)                                        {                                                                                                vec3 LightDirection = In.WorldPos - l.Position;                                                float Distance = length(LightDirection);                                                     LightDirection = normalize(LightDirection);                                                                                                                                               vec4 Color = CalcLightInternal(l.Base, LightDirection, In);                              float Attenuation =  l.Atten.Constant +                                                                           l.Atten.Linear * Distance +                                                                  l.Atten.Exp * Distance * Distance;                                                                                                                                   return Color / Attenuation;                                                              }                                                                                                                                                                                         vec4 CalcSpotLight(SpotLight l, VSOutput1 In)                                          {                                                                                                vec3 LightToPixel = normalize(In.WorldPos - l.Base.Position);                                  float SpotFactor = dot(LightToPixel, l.Direction);                                                                                                                                        if (SpotFactor > l.Cutoff) {                                                                     vec4 Color = CalcPointLight(l.Base, In);                                                 return Color * (1.0 - (1.0 - SpotFactor) * 1.0/(1.0 - l.Cutoff));                        }                                                                                            else {                                                                                           return vec4(0,0,0,0);                                                                    }                                                                                        }                                                                                                                                                                                         void main(in VSOutput FSin, out vec4 FragColor) {                                         VSOutput1 In;     In.TexCoord = FSin.TexCoord;     In.Normal = normalize(FSin.Normal);     In.WorldPos = FSin.WorldPos;                                                                        vec4 TotalLight = CalcDirectionalLight(In);                                                                                                                                           for (int i = 0 ; i < gNumPointLights ; i++) {                                                    TotalLight += CalcPointLight(gPointLights[i], In);                                   }                                                                                                                                                                                         for (int i = 0 ; i < gNumSpotLights ; i++) {                                                     TotalLight += CalcSpotLight(gSpotLights[i], In);                                     }                                                                                                                                                                                         FragColor = texture(gColorMap, In.TexCoord.xy) * TotalLight;      }  
  2. Thank you for your hint, now i use D3DXCreateCubeTextureFromFile,it's OK!
  3. Hi,all I find that texCUBE always return zero using Pix debug tool, the inReflect coodinate isn't zero; Does anyone know the error? Thanks! This is my code: texture EnvironmentMap < string type = "CUBE"; string name = "Snow.dds"; >; samplerCUBE EnvMap = sampler_state { Texture = (EnvironmentMap); MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; AddressU = Wrap; AddressV = Wrap; }; sampler2D Wood; float4 Main(float2 inTxr: TEXCOORD0,float3 inReflect: TEXCOORD1) : COLOR { float4 tmp=texCUBE(EnvMap,inReflect.xyz); return tmp; }
  4. OK, Thank You! I will try it.
  5. ah, I draw a ball, when i move it away from camera center, it is stretched on the side away from camera center. I use directX 9.0 and C++, when i modifed fov to be smaller as panic mentioned, it's ok. but i found that enen at the camera center, the ball is not complete spherical, but use DirectX Viewer tool, it looks complete spherical. // // Set camera. // D3DXVECTOR3 pos(0.0f, 0.0f, -10.0f); D3DXVECTOR3 target(0.0f, 0.0f, 0.0f); D3DXVECTOR3 up(0.0f, 1.0f, 0.0f); D3DXMATRIX V; D3DXMatrixLookAtLH( &V, &pos, &target, &up); Device->SetTransform(D3DTS_VIEW, &V); // // Set projection matrix. // D3DXMATRIX proj; D3DXMatrixPerspectiveFovLH( &proj, D3DX_PI * 0.1f, (float)Width/(float)Height, //Window size ratio 1.0f, 10000.0f); Device->SetTransform(D3DTS_PROJECTION, &proj);
  6. Hi, I move the model away from camera cental in the plane perpendicular to camera direction, it become deformed, anyone can tell me what's wrong? thank you!