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


  • Content count

  • Joined

  • Last visited

Community Reputation

95 Neutral

About dealeer

  • Rank
  1. hello, I come here baring a cry for help. I needed an atmosphere shader for the little project I am working on. so I convert the SkyFormSpace shader in the book GPU gems 2- Chapter 16, Accurate Atmospheric Scattering written by Sean O'Neil to SkyFormSpace.fx. I want to see the atmosphere effect in the software FX Composer . but the result is incorrect? the effect in FxComposer: [img]http://fmn.xnpic.com/fmn057/20121206/2130/original_T9ix_6f2800000af1118e.jpg[/img] and the effect in my project: [img]http://fmn.rrimg.com/fmn063/20121206/2130/original_VJuS_5da900000ae1118f.jpg[/img] Here is the shader code i'm using: [CODE] // SkyFromSpace - Author: Sean O'Neil - Copyright (c) 2004 Sean O'Neil //The output of this vertex shader struct vertout { float4 pos : POSITION; // Transformed vertex position float4 c0 : COLOR0; // The Rayleigh color float4 c1 : COLOR1; // The Mie color float3 t0 : TEXCOORD0; }; //The number of sample points taken along the ray const int nSamples = 2; const float fSamples =2.0; //The scale depth (the altitude at which the average atmospheric density is found) const float fScaleDepth = 0.25; const float fInvScaleDepth = 4.0; //The scale equation calculated by Vernier's Graphical Analysis float scale(float fCos) { float x = 1.0 - fCos; return fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25)))); } //Calculates the Mie phase function float getMiePhase(float fCos, float fCos2, float g, float g2) { return 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos2) / pow(1.0 + g2 - 2.0*g*fCos, 1.5); } //Calculates the Rayleigh phase function float getRayleighPhase(float fCos2) { //return 1.0; return 0.75 + 0.75*fCos2; } //Returns the near intersection point of a line and a sphere float getNearIntersection(float3 v3Pos, float3 v3Ray, float fDistance2, float fRadius2) { float B = 2.0 * dot(v3Pos, v3Ray); float C = fDistance2 - fRadius2; float fDet = max(0.0, B*B - 4.0 * C); return 0.5 * (-B - sqrt(fDet)); } //Returns the far intersection point of a line and a sphere float getFarIntersection(float3 v3Pos, float3 v3Ray, float fDistance2, float fRadius2) { float B = 2.0 * dot(v3Pos, v3Ray); float C = fDistance2 - fRadius2; float fDet = max(0.0, B*B - 4.0 * C); return 0.5 * (-B + sqrt(fDet)); } //uniform float4x4 gl_ModelViewProjectionMatrix; uniform float4x4 worldViewProj: WorldViewProjection; uniform float3 v3CameraPos={0.0,0.0,25};// The camera's current position uniform float3 v3LightPos={0.0,0.0,1}; // The direction vector to the light source uniform float fOuterRadius=10.15f; // The outer (atmosphere) radius uniform float fInnerRadius=10.0f; // The inner (planetary) radius uniform float red = 0.650f; // 650 nm for red uniform float green = 0.570f; // 570 nm for green uniform float blue = 0.475f; // 475 nm for blue uniform float Kr = 0.0025f; uniform float Km = 0.0015f; uniform float PI = 3.14159f; uniform float ESun = 15.0f; vertout v_SkyFormSpace(float4 gl_Vertex : POSITION) { float3 v3InvWavelength={1.0/pow(red, 4.0f),1.0/pow(green, 4.0f),1.0/pow(blue, 4.0f)}; float fCameraHeight=sqrt(v3CameraPos.x*v3CameraPos.x+v3CameraPos.y*v3CameraPos.y+v3CameraPos.z*v3CameraPos.z); float fCameraHeight2=fCameraHeight*fCameraHeight; float fOuterRadius2=fOuterRadius*fOuterRadius; float fInnerRadius2=fInnerRadius*fInnerRadius; float fKrESun=Kr * ESun; float fKmESun=Km * ESun; float fKr4PI=Kr * 4 * PI; float fKm4PI=Km * 4 * PI; float fScale=1.0 / (fOuterRadius - fInnerRadius); float fScaleOverScaleDepth=fScale / fScaleDepth; // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere) float3 v3Pos = gl_Vertex.xyz; float3 v3Ray = v3Pos - v3CameraPos; float fFar = length(v3Ray); v3Ray /= fFar; // Calculate the closest intersection of the ray with the outer atmosphere (which is the near point of the ray passing through the atmosphere) float fNear = getNearIntersection(v3CameraPos, v3Ray, fCameraHeight2, fOuterRadius2); // Calculate the ray's start and end positions in the atmosphere, then calculate its scattering offset float3 v3Start = v3CameraPos + v3Ray * fNear; fFar -= fNear; float fStartAngle = dot(v3Ray, v3Start) / fOuterRadius; float fStartDepth = exp(-1.0 / fScaleDepth); float fStartOffset = fStartDepth*scale(fStartAngle); // Initialize the scattering loop variables float fSampleLength = fFar / fSamples; float fScaledLength = fSampleLength * fScale; float3 v3SampleRay = v3Ray * fSampleLength; float3 v3SamplePoint = v3Start + v3SampleRay * 0.5; // Now loop through the sample rays float3 v3FrontColor = float3(0.0, 0.0, 0.0); for(int i=0; i<nSamples; i++) { float fHeight = length(v3SamplePoint); float fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight)); float fLightAngle = dot(v3LightPos, v3SamplePoint) / fHeight; //float fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight; float fCameraAngle = 1.0; float fScatter = (fStartOffset + fDepth*(scale(fLightAngle) - scale(fCameraAngle))); float3 v3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI)); v3FrontColor += v3Attenuate * (fDepth * fScaledLength); v3SamplePoint += v3SampleRay; } // Finally, scale the Mie and Rayleigh colors and set up the varying variables for the pixel shader vertout OUT; OUT.pos = mul(gl_Vertex,worldViewProj); OUT.c0.rgb = v3FrontColor * (v3InvWavelength * fKrESun); OUT.c1.rgb = v3FrontColor * fKmESun; OUT.t0 = v3CameraPos - v3Pos; return OUT; } //uniform float3 v3LightPos; uniform float g=-0.95; uniform float g2=0.9025; float4 p_SkyFormSpace(in float4 c0 : COLOR0, in float4 c1 : COLOR1, in float3 v3Direction : TEXCOORD0 ) : COLOR { float fCos = dot(v3LightPos, v3Direction) / length(v3Direction); float fCos2 = fCos*fCos; float4 color = getRayleighPhase(fCos2) * c0 + getMiePhase(fCos, fCos2, g, g2) * c1; color.a = color.b; return color; } technique technique0 { pass p0 { CullMode = None; VertexShader = compile vs_3_0 v_SkyFormSpace(); PixelShader = compile ps_3_0 p_SkyFormSpace(); } } [/CODE] If anyone could help me with a fix or have some advice to help me solve the problem, it will be greatly appreciated.
  2. [img]C:\FxComposer.jpg[/img]