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

YashwinderSingh

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

115 Neutral

About YashwinderSingh

  • Rank
    Newbie
  1. I have tried using all these below stated rendering states before assigning the pixel shader to the device and in the render loop per frame also but even then there is no effect on the alpha value     _device.SetRenderState(RenderState.AlphaBlendEnable, true);             _device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);             _device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);             _device.SetTextureStageState(0, TextureStage.ColorOperation, TextureOperation.Modulate);             _device.SetTextureStageState(0, TextureStage.ColorArg1, TextureArgument.Texture);             _device.SetTextureStageState(0, TextureStage.ColorArg2, TextureArgument.TFactor); Can any one please tell whats the proper method of setting alpha value for the texture to change its transperancy. 
  2. I have tried using all these below stated rendering states before assigning the pixel shader to the device and in the render loop per frame also but even then there is no effect on the alpha value     _device.SetRenderState(RenderState.AlphaBlendEnable, true);             _device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);             _device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);             _device.SetTextureStageState(0, TextureStage.ColorOperation, TextureOperation.Modulate);             _device.SetTextureStageState(0, TextureStage.ColorArg1, TextureArgument.Texture);             _device.SetTextureStageState(0, TextureStage.ColorArg2, TextureArgument.TFactor); Can any one please tell whats the proper method of setting alpha value for the texture to change its transperancy. 
  3. I have created a sample code for the same problem I was facing to set alpha and have given the complete code above
  4. I am trying to set alpha value of color as color.a = 0.2 in my pixel shader but it is not showing any effect. If I set color.r, color.g, color.b then they work fine according to the values set in the pixel shader. Simple pixel shader code is given below that I am using sampler2D ourImage : register(s0);     float4 main(float2 locationInSource : TEXCOORD) : COLOR     {        float4 color = tex2D( ourImage , locationInSource.xy);        color.a = 0.2;        return color;     }   My complete rendering code is as below       using System;using System.Drawing; using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Windows; using System.Windows.Interop; using SlimDX; using SlimDX.Direct3D9; using Point = System.Windows.Point; namespace AlphaBlendTesting { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { #region Private Variables private Device _device; private VertexBuffer _vertexBuffer; private static VertexDeclaration _vertexDeclaration; private Texture _texture; private Surface _renderTarget; #endregion public MainWindow() { InitializeComponent(); this.Loaded += MainWindow_Loaded; } void MainWindow_Loaded(object sender, RoutedEventArgs e) { InitializeDevice(); InitializeVertices(); ThreadPool.QueueUserWorkItem(delegate { RenderEnvironment(); }); } private void InitializeDevice() { var direct3D = new Direct3D(); var windowHandle = new WindowInteropHelper(this).Handle; var presentParams = new PresentParameters { Windowed = true, BackBufferWidth = (int)SystemParameters.PrimaryScreenWidth, BackBufferHeight = (int)SystemParameters.PrimaryScreenHeight, // Enable Z-Buffer // This is not really needed in this sample but real applications generaly use it EnableAutoDepthStencil = true, AutoDepthStencilFormat = Format.D16, // How to swap backbuffer in front and how many per screen refresh BackBufferCount = 1, SwapEffect = SwapEffect.Copy, BackBufferFormat = direct3D.Adapters[0].CurrentDisplayMode.Format, PresentationInterval = PresentInterval.Default, DeviceWindowHandle = windowHandle }; _device = new Device(direct3D, 0, DeviceType.Hardware, windowHandle, CreateFlags.SoftwareVertexProcessing | CreateFlags.Multithreaded, presentParams); var shaderByteCode = ShaderBytecode.Compile(File.ReadAllBytes(@"EdgeBlenDing.fx"), "main", "ps_2_0", ShaderFlags.None); var pixelShader = new PixelShader(_device, shaderByteCode); _device.PixelShader = pixelShader; } private void InitializeVertices() { _renderTarget = _device.GetRenderTarget(0); var vertexBuffer = new VertexBuffer(_device, 6 * Vertex.SizeBytes, Usage.WriteOnly, VertexFormat.Normal, Pool.Managed); using (DataStream stream = vertexBuffer.Lock(0, 0, LockFlags.None)) { stream.WriteRange(BuildVertexData()); vertexBuffer.Unlock(); } _vertexBuffer = vertexBuffer; //Setting the vertex elements var vertexElems = new[]  { new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position , 0), new VertexElement(0, 12 , DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0), VertexElement.VertexDeclarationEnd }; //Declaring the vertex _vertexDeclaration = new VertexDeclaration(_device, vertexElems); SetRenderState(); _texture = Texture.FromFile(_device, @"C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg"); } private void SetRenderState() { // Turn off culling, so we see the front and back of the triangle _device.SetRenderState(RenderState.CullMode, Cull.None); // Turn off lighting _device.SetRenderState(RenderState.Lighting, false); } private void RenderEnvironment() { while (true) { try { _device.BeginScene(); _device.Clear(ClearFlags.ZBuffer, Color.Blue, 1.0f, 0); _device.SetTexture(0, _texture); _device.SetRenderTarget(0, _renderTarget); _device.VertexDeclaration = _vertexDeclaration; _device.SetStreamSource(0, _vertexBuffer, 0, Vertex.SizeBytes); _device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2); _device.EndScene(); //Show what we draw _device.Present(); } catch (Exception e) { } } } private Vertex[] BuildVertexData() { var bottomLeftVertex = new Point(0, 0); var topLeftVertex = new Point(0, 1); var bottomRightVertex = new Point(1, 0); var topRightVertex = new Point(1, 1); var vertexData = new Vertex[6]; vertexData[0].Position = new Vector3(-1.0f, 1.0f, 0.0f); vertexData[0].TextureCoordinate = new Vector2((float)bottomLeftVertex.X, (float)bottomLeftVertex.Y); vertexData[1].Position = new Vector3(-1.0f, -1.0f, 0.0f); vertexData[1].TextureCoordinate = new Vector2((float)topLeftVertex.X, (float)topLeftVertex.Y); vertexData[2].Position = new Vector3(1.0f, 1.0f, 0.0f); vertexData[2].TextureCoordinate = new Vector2((float)bottomRightVertex.X, (float)bottomRightVertex.Y); vertexData[3].Position = new Vector3(-1.0f, -1.0f, 0.0f); vertexData[3].TextureCoordinate = new Vector2((float)topLeftVertex.X, (float)topLeftVertex.Y); vertexData[4].Position = new Vector3(1.0f, -1.0f, 0.0f); vertexData[4].TextureCoordinate = new Vector2((float)topRightVertex.X, (float)topRightVertex.Y); vertexData[5].Position = new Vector3(1.0f, 1.0f, 0.0f); vertexData[5].TextureCoordinate = new Vector2((float)bottomRightVertex.X, (float)bottomRightVertex.Y); return vertexData; } [StructLayout(LayoutKind.Sequential)] struct Vertex { public Vector3 Position; public Vector2 TextureCoordinate; public static int SizeBytes { get { return Marshal.SizeOf(typeof(Vertex)); } } } } I am unable to figure out why alpha value is not getting set. Any kind of help is appreciated.
  5. [color=#000000][font=Arial,]I have coded a video player using directshow and EVR filter. I am having a problem of slow playback in a machine with configuration:[/font][/color] [color=#000000][font=Arial,]Processor: AMD E-350 1.60 GHz Ram: 2 GB[/font][/color] [color=#000000][font=Arial,]The videos with resolution 1440*1080 or 1920*1080 and above plays fine in windows media player and Media player classic-HC but not the way I am rendering it.[/font][/color] PLayback is smooth in other machines with processors like intel dual core and above. [color=#000000][font=Arial,]I am just adding the evr filter to the graph i have made of the video and playing it. Is there any way to improve the playback quality of the video on this machine. any help is appreciated.[/font][/color]