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

qventura

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

107 Neutral

About qventura

  • Rank
    Newbie
  1. [color=#000000] [url="http://msdn.microsoft.com/en-us/library/cc663104.aspx"]http://msdn.microsoft.com/en-us/library/cc663104.aspx[/url] "Multisampling is allowed on [b]IDirect3DSurface9Ex[/b] surfaces only." But this interface [b]IDirect3DSurface9Ex[/b] doesnt seem to exist ![/color]
  2. Hi everyone, I'm trying to implement a renderengine using Direct3D 10 (SlimDX) and WPF. I create my device and rendertargetview with the right MultiSample parameters ( 1,0 / 2,0 and 4,0 are working) [code] this.multiSamplingDescription = new SampleDescription(sampleCount, qualityLevel - 1); // 4,1 Texture2DDescription colordesc = new Texture2DDescription(); colordesc.BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource; colordesc.Format = this.renderTargetViewFormat; // Format.B8G8R8A8_UNorm colordesc.Width = width; colordesc.Height = height; colordesc.MipLevels = 1; colordesc.SampleDescription = multiSamplingDescription; colordesc.Usage = ResourceUsage.Default; colordesc.OptionFlags = ResourceOptionFlags.Shared; colordesc.CpuAccessFlags = CpuAccessFlags.None; colordesc.ArraySize = 4;[/code] Then I've got a problem while trying to create the shared texture for D3DImage ... [code] this.Direct3D9Context = new Direct3DEx(); this.presentParams = new PresentParameters(); this.presentParams.Windowed = true; this.presentParams.SwapEffect = SwapEffect.Discard; this.presentParams.DeviceWindowHandle = GetDesktopWindow(); this.presentParams.PresentationInterval = PresentInterval.Immediate; this.presentParams.Multisample = MultisampleType.None; this.presentParams.MultisampleQuality = 0; this.Device = new DeviceEx(this.Direct3D9Context, 0, DeviceType.Hardware, IntPtr.Zero, CreateFlags.HardwareVertexProcessing | CreateFlags.Multithreaded | CreateFlags.FpuPreserve, this.presentParams); ... this.presentParams.Multisample = sampleCount; // = 4 this.presentParams.MultisampleQuality = 0; this.Device.Reset(this.presentParams); ... this.SharedTexture = new Texture(this.Device, texture.Description.Width, texture.Description.Height, 1, Usage.RenderTarget, format, Pool.Default, ref Handle); // format = Format.A8R8G8B8 // Width = 1244 , same as colordesc // height = 699, same as colordesc [/code] I'm missing something ?
  3. Hi everyone, I've got a little probleme with AlphaBlending. My simplified scene is composed by a textured quad, and an outlined polygon (that's the problem ) First, I call draw to display a textured Quad Then, I've got a second call to Draw using an other effect with 2 pass. First pass draw the expended polygon with (1,0,0,1) as color The second Pass draw the original polygon with (1, 0, 0, 0.6) So, basically, I would like to to draw a semi-transparent polygon with an opaque outline, and I want to see my texture beyond. Is that possible ? In my 2nd pass, can i access to the pixel color before the first pass ? Here are my shaders ... [code]technique PositionNormal { pass Outline { VertexShader = compile vs_3_0 OutlineVS(); PixelShader = compile ps_3_0 OutlinePS(); AlphaBlendEnable = TRUE; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; BlendOp = Add; } pass Inner { VertexShader = compile vs_3_0 VS(); PixelShader = compile ps_3_0 PS(); AlphaBlendEnable = TRUE; SrcBlend = SrcAlpha; DestBlend = InvDestAlpha; BlendOp = 4; } }[/code] Thanks in advance
  4. Nobody got an idea ?
  5. Hi, I got a strange flickering problem in my scene ... When i move the camera (pan or zoom), the NeedToRender boolean is seted as true, it call the render function [code] public bool Render() { if (isReadyToRender() && NeedToRender) { worldEffectVariable.SetMatrix(worldMatrix); viewEffectVariable.SetMatrix(camera.ViewMatrix); projectionEffectVariable.SetMatrix(camera.ProjectionMatrix); D3DDevice.ClearDepthStencilView(depthView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0); D3DDevice.ClearRenderTargetView(renderView, new Color4(new Vector4(1.0f, 0.0f, 0.0f, 1.0f))); foreach (IModel model in ModelsToRender) { if (model.GetType() == typeof(TexturedModel)) { Matrix objectTranformMatrix = Matrix.Scaling((float)((TexturedModel)model).Width / 2.0f, (float)((TexturedModel)model).Height / 2.0f, 1.0f); objectTranformMatrix = Matrix.Multiply(objectTranformMatrix, Matrix.Translation((float)((TexturedModel)model).Width / 2.0f, (float)((TexturedModel)model).Height / 2.0f, 0.0f)); objectTransformEffectVariable.SetMatrix(objectTranformMatrix); currentRenderer = texturedRenderer; texturedRenderer.GetTexture(model.Id, out currentTexture); textureEffectVariable.SetResource(currentTexture); } else if (model.GetType() == typeof(SphereTargetModel)) { Matrix objectTranformMatrix = Matrix.Translation(((SphereTargetModel)model).CurrentPosition.X, ((SphereTargetModel)model).CurrentPosition.Y, -20.0f); objectTransformEffectVariable.SetMatrix(objectTranformMatrix); colorEffectVariable.Set(Convertor.ToVector4(((SphereTargetModel)model).Color)); currentRenderer = sphereRenderer; } else { currentRenderer = diskRenderer; } technique = effect.GetTechniqueByName(currentRenderer.TypeName); pass = technique.GetPassByIndex(0); layout = new InputLayout(D3DDevice, pass.Description.Signature, currentRenderer.InputElements); D3DDevice.InputAssembler.SetInputLayout(layout); D3DDevice.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList); D3DDevice.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(currentRenderer.VerticesBuffer, currentRenderer.VertexSize, 0)); D3DDevice.InputAssembler.SetIndexBuffer(currentRenderer.IndicesBuffer, Format.R16_UInt, 0); for (int i = 0; i < technique.Description.PassCount; ++i) { pass.Apply(); D3DDevice.DrawIndexed(currentRenderer.IndicesNumber, 0, 0); } layout.Dispose(); } D3DDevice.Flush(); camera.HasChanged = false; sceneHasChanged = false; renderingTime = DateTime.Now.Subtract(beginTime); if (renderingTime.Milliseconds != 0) { Console.WriteLine("DX10 : RenderingTime = " + renderingTime.Milliseconds + " FPS = " + (1000 / renderingTime.Milliseconds)); } return true; } return false; }[/code] Here is my OnRendering function, called by my WPF Control [code] public void OnRendering(object sender, EventArgs e) { if (RenderEngine.Render()) { if (RenderEngine.BackBufferSurface != null) { D3DTarget.Invalidate(); } } }[/code] Invalidate is called only when something append in my rendering engine D3DTarget is a "D3DImageSlimDX", qnd here is the Invalidate function [code] public void Invalidate() { if (SharedTexture != null) { Lock(); AddDirtyRect(new Int32Rect(0, 0, PixelWidth, PixelHeight)); Unlock(); } }[/code] The strange thing is that the flickering appear for every object of my scene (ObjetcsToRender) EXCEPT the first one By the way, I've got the same probleme with my D3D9 Engine .... I think that's a DirtyRect problem but i'm not sure ! [Edit] Just adding my device initialization: [code] public void InitDevice() { ReleaseDevice(); Texture2DDescription colordesc = new Texture2DDescription(); colordesc.BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource; colordesc.Format = Format.B8G8R8A8_UNorm; colordesc.Width = ControlWidth; colordesc.Height = ControlHeight; colordesc.MipLevels = 1; colordesc.SampleDescription = new SampleDescription(1, 0); colordesc.Usage = ResourceUsage.Default; colordesc.OptionFlags = ResourceOptionFlags.Shared; colordesc.CpuAccessFlags = CpuAccessFlags.None; colordesc.ArraySize = 1; Texture2DDescription depthdesc = new Texture2DDescription(); depthdesc.BindFlags = BindFlags.DepthStencil; depthdesc.Format = Format.D32_Float_S8X24_UInt; depthdesc.Width = ControlWidth; depthdesc.Height = ControlHeight; depthdesc.MipLevels = 1; depthdesc.SampleDescription = new SampleDescription(1, 0); depthdesc.Usage = ResourceUsage.Default; depthdesc.OptionFlags = ResourceOptionFlags.None; depthdesc.CpuAccessFlags = CpuAccessFlags.None; depthdesc.ArraySize = 1; BackBufferSurface = new Texture2D(D3DDevice, colordesc); DepthTexture = new Texture2D(D3DDevice, depthdesc); renderView = new RenderTargetView(D3DDevice, BackBufferSurface); depthView = new DepthStencilView(D3DDevice, DepthTexture); D3DDevice.OutputMerger.SetTargets(depthView, renderView); D3DDevice.Rasterizer.SetViewports(new Viewport(0, 0, ControlWidth, ControlHeight, 0.0f, 1.0f)); D3DDevice.Flush(); deviceReadyToRender = true; }[/code] Thanks in advance, Q
  6. Hi, I don't really understand how "cameras" work with D3D9 First, how i set my camera up: [code] public Camera() { this.eye = new Vector3(0.0f, 0.0f, 0.0f); this.lookAt = new Vector3(0.0f, 0.0f, 1.0f); this.up = new Vector3(0.0f, 1.0f, 0.0f); viewMatrix = Matrix.LookAtLH(eye, lookAt, up); projectionMatrix = Matrix.OrthoLH(1 * zoomLevel, 1 * zoomLevel, 0.0f, 1.0f); }[/code] And my vertices : [code] vertices = new VertexTexture[] { new VertexTexture() { Position = new Vector4(0.0f, 0.0f, 0.0f, 1.0f), TextureCoord = new Vector2(0.0f, 1.0f) }, new VertexTexture() { Position = new Vector4(0.0f, model.Height, 0.0f, 1.0f), TextureCoord = new Vector2(0.0f, 0.0f) }, new VertexTexture() { Position = new Vector4(model.Width, model.Height, 0.0f, 1.0f), TextureCoord = new Vector2(1.0f, 0.0f) }, new VertexTexture() { Position = new Vector4(model.Width, 0.0f, 0.0f, 1.0f), TextureCoord = new Vector2(1.0f, 1.0f) } };[/code] It works. I can move the camera, zoom, etc. But the cameras properties seems weird to me ! I thought it would be something like: [code] public Camera() { this.eye = new Vector3(0.0f, 0.0f, 1.0f); this.lookAt = new Vector3(0.0f, 0.0f, 0.0f); this.up = new Vector3(0.0f, 1.0f, 0.0f); viewMatrix = Matrix.LookAtLH(eye, lookAt, up); projectionMatrix = Matrix.OrthoLH(1 * zoomLevel, 1 * zoomLevel, 0.1f, 100.0f); }[/code] but with that parameters it doesn't work. Same if i change the Z coordinate for my plan (Which need to be set at 0 to work). Now, i try to render other objects. I generate vertices for a sphere (it works fine on D3D 10, a 1 radius sphere generated around (0;0;0) ) but nothing appear on the screen I played with the eye and lookat parameters but i can figure how to make it work, so, what i m doing wrong ?
  7. Ok I was using the wrong coordinate system .. I should use screen coordinate (pixel) with PositionTransformed, and -1;1 system with Position ... I feel stupid !
  8. Hi everyone, My code below is working, with a DeclarationUsage.PositionTransformed. Now i want to add a camera, so i need to use DeclarationUsage.Position, But, even if i'm not doing anything, (I'm not modifyinf the position, and applying a fixed color to the pixel, nothing append ... Does anyone see something wrong ? My Vertex struct [code] public struct VertexTexture { public Vector4 Position; public Vector2 TextureCoord; }[/code] My rendering function [code] viewMatrix = camera.ViewMatrix; projectionMatrix = camera.ProjectionMatrix; D3Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, new Color4(System.Drawing.Color.Red), 1, 0); D3Device.BeginScene(); D3Device.SetStreamSource(0, vertices, 0, 24); D3Device.VertexDeclaration = vertexDecl; D3Device.Indices = indices; int numPasses = effect.Begin(); { for (int i = 0; i < numPasses; i++) { effect.BeginPass(i); D3Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, /* Dynamic */6, 0, 2); effect.EndPass(); } } effect.End(); D3Device.EndScene(); D3Device.Present();[/code] My VertexDeclaration [code] vertexDecl = new VertexDeclaration(D3Device, new[] { new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0), new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0), VertexElement.VertexDeclarationEnd });[/code] There is my shaders. I'm remove everything, just want to display my quad with a fixed color [code]float4x4 WorldProjection; texture textureToApply; struct VS_OUT { float4 Position : POSITION; float2 TextureCoord : TEXCOORD0; }; struct PS_OUT { float4 Color : COLOR0; }; VS_OUT VS( float4 Position : POSITION, float2 TextureCoord : TEXCOORD0 ) { VS_OUT output = (VS_OUT)0; output.Position = Position; output.TextureCoord = TextureCoord; return output; } PS_OUT PS( VS_OUT input) { PS_OUT output; output.Color = float4(0.0f, 1.0f, 0.0f, 1.0f); return output; } technique Render { pass P0 { VertexShader = compile vs_3_0 VS(); PixelShader = compile ps_3_0 PS(); } }[/code]
  9. Hi, I got a very simple program ... [code] static class Program { /// <summary> /// Point d'entrée principal de l'application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 form1 = new Form1(); //form1.init(); MessagePump.Run(form1, () => { //form1.run(); }); //form1.clear(); } } }[/code] Form1 do nothing (Constructor empty) When i run the program, it use 50% of my CPU ! (It's a Intel Core 2 Duo that's why it uses "only" 50%) Is that normal ?