Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Go Back  Xtreme Visual Basic Talk > > > > Direct3d: Render 2Dimage with a shader


Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2010, 11:16 AM
Zosimas Zosimas is offline
Newcomer
 
Join Date: May 2007
Posts: 3
Smile [SOLVED] Direct3d: Render 2Dimage with a shader


At the first step of my program, I use 'RenderToSurface' technique
to draw my scene to a texture.
At the second step, I want to draw this texture to the screen with the
use of a pixel shader effect.

I tried 'Sprites' but the shader has no effect on my image.

Any idea?

Last edited by Zosimas; 01-20-2010 at 11:11 AM. Reason: Solved
Reply With Quote
  #2  
Old 01-20-2010, 11:08 AM
Zosimas Zosimas is offline
Newcomer
 
Join Date: May 2007
Posts: 3
Smile [SOLVED] Direct3d: Render 2Dimage with a shader

Problem SOLVED!

I use quads and render them with an OrthoLH Projection.
Here is the code:
----------------------------------------------------------------------
Code:
'Declare vertices
Private vertices(5) As CustomVertex.PositionNormalTextured

'Set vertices
vertices(0).X = -Width
vertices(0).Y = -Height
vertices(0).Tu = 1
vertices(0).Tv = 0

vertices(1).X = Width
vertices(1).Y = Height
vertices(1).Tu = 0
vertices(1).Tv = 1

vertices(2).X = Width
vertices(2).Y = -Height
vertices(2).Tu = 0
vertices(2).Tv = 0

vertices(3).X = -Width
vertices(3).Y = -Height
vertices(3).Tu = 1
vertices(3).Tv = 0

vertices(4).X = -Width
vertices(4).Y = Height
vertices(4).Tu = 1
vertices(4).Tv = 1

vertices(5).X = Width
vertices(5).Y = Height
vertices(5).Tu = 0
vertices(5).Tv = 1

'Set World, View, Projection
device.Transform.World = Matrix.Identity * Matrix.Translation(0, 0, 0)
device.Transform.View = Matrix.Identity * Matrix.Translation(New Vector3(-1, -1, 0))
device.Transform.Projection = Matrix.OrthoLH(-Width * 2, -Height * 2, 0, 1)

'Render quads
Passes = blurEffect.Begin(FX.None)
For k = 0 To Passes - 1
blurEffect.BeginPass(k)
DEV.VertexFormat = CustomVertex.PositionNormalTextured.Format
DEV.DrawUserPrimitives(PrimitiveType.TriangleList, 2, vertices)
blurEffect.EndPass()
Next k
blurEffect.End()
----------------------------------------------------------------------

I really don't understand why width and height must be multiplied with 2
but this works perfect!

Last edited by Zosimas; 01-20-2010 at 11:13 AM. Reason: Solved
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
 
Direct3d: Render 2Dimage with a shader
Direct3d: Render 2Dimage with a shader
 
-->