a computer program that runs on graphics hardware and provides a high degree of control over how scenes are rendered
2
votes
1answer
90 views
Nine Patch Images in DirectX
In Android development I found nine patch images very useful to draw images that have a fixed border. When the image is scaled the inner part scales, but the border stays at a fixed size.
I was ...
1
vote
1answer
289 views
Why can't my .exe find my .fx file?
I'm having a problem with my .fx file in my D3D 11 application.
I can run the application just fine from Visual Studio, but when I run the .exe it fails when trying to load the .fx file.
I've ...
2
votes
1answer
248 views
Spherical procedural terrain shader based on slope
I've created a spherical terrain object out of 6 sphere projected (normalised) planes, each plane has been heightmapped post to being normalised.
I'm looking to create a CG shader which will ...
9
votes
3answers
974 views
Fastest way to render lines with AA, varying thickness in DirectX
So I'm doing some DirectX development, using SharpDX under .NET to be exact (but DirectX/C++ API solutions are applicable). I'm looking for the fastest way to render lines in an orthogonal projection ...
4
votes
3answers
407 views
OpenGL ES 2.0 - How to batch draw particles that have unique translations, rotations, scales, and alphas?
I've combined all of my vertex data for many particles into a single array. How would I batch draw all of those particles in a manner that preserves their unique translations?
Any code examples ...
3
votes
1answer
168 views
Why are some objects not rendering properly?
Here's a button I exported from Blender into a .x format:
Now here it is in the game with BasicEffect applied to everything:
And now with my custom shader:
And there's the problem. While the ...
2
votes
0answers
411 views
VS2012 C++: Unable to ID3D11Device::CreateVertexShader when loading compiled CSO file
I have been trying to get a tutorial Direct X 11 application running for some time now. I'm being stymied when I try to create the vertex shader. Setting the Direct X Debug setting reveals that I am ...
1
vote
0answers
153 views
Vertex shader to Pixel shader NVIDIA problem - restarting drivers
I have problem with my shader on NVIDIA cards. On AMD it's working right.
Shader Builder exported CODE:
//ROOT
//PSParts
//VSParts
//Samplers
sampler sLod23ColorGround : register(s0);
sampler ...
6
votes
1answer
277 views
Changing water color based on depth
I'm looking to make a water shader that colors the water based on its depth. Up until now my water shader that I've used has basically been extremely reflective and only looked somewhat blue because ...
1
vote
1answer
248 views
Apply portion of texture atlas
I'm trying to write a shader that only maps a portion of a large texture to my sprite and I'm getting a strange behaviour with my current code.
This is what I have right now:
Texture atlas ...
14
votes
3answers
555 views
Difference between Material and Shader
In a game a material does only influence the visual appearance of the object. The visual appearance is effected by shaders. So regarding to terminology is there a difference between materials and ...
4
votes
2answers
290 views
ConsumeStructuredBuffer, what am I doing wrong?
I'm trying to implement the 3rd exercise in chapter 12 of Introduction to 3D Game Programming with DirectX 11, that is:
Implement a Compute Shader to calculate the length of 64 vectors.
Previous ...
2
votes
1answer
190 views
VBO and shaders confusion, what's their connection?
Considering OpenGL 2.1 VBOs and 1.20 GLSL shaders:
When creating an entity like "Zombie", is it good to initialize just the VBO buffer with the data once and do N glDrawArrays() calls per each N ...
1
vote
0answers
167 views
How do I make a more or less realistic water surface?
I want to make a similar water surface like in this picture: http://www.publicdomainpictures.net/pictures/20000/velka/water-surface-detail-11291208064MpI.jpg
I need the water surface in the same view ...
2
votes
1answer
135 views
Shadow cubemapping?
I am working on a game with C++ and OpenGL 3.2. I have successfully implemented directional shadow maps and now I'd like to upgrade them to shadow cube maps (for point lights). I've done some Googling ...
3
votes
2answers
181 views
Which will be faster? Switching shaders or ignore that some cases don't need full code?
I have two types of 2d objects:
In first case (for about 70% of objects), I need that code in the shader:
float2 texCoord = input.TexCoord + textureCoord.xy
But in the second case I have to use:
...
2
votes
1answer
2k views
Unity3D draw call optimization : static batching VS manually draw mesh with MaterialPropertyBlock
I've read Unity3D draw call batching documentation.
I understood it, and I want to use it (or something similar) in order to optimize my application.
My situation is the following:
I'm drawing ...
9
votes
4answers
517 views
Avoid if statements in DirectX 10 shaders?
I have heard that if statements should be avoid in shaders, because both parts of the statements will be execute, and than the wrong will be dropped (which harms the performance).
It's still a ...
3
votes
1answer
500 views
How are vertex shader outs sent as inputs to the fragment shader?
I'm learning some OpenGL 3.2 way of doing things and I think it's quite great, I'm actually understanding more of shaders and non-fixed pipeline in 1 week rather than those 2 years I tried to learn ...
1
vote
1answer
240 views
Light following me around the room. Something is wrong with my shader!
I'm trying to do a spot (Blinn) light, with falloff and attenuation. It seems to be working OK except I have a bit of a space problem. That is, whenever I move the camera the light moves to maintain ...
14
votes
2answers
355 views
OpenGL: Where shoud I place shaders?
I'm trying to learn OpenGL ES 2.0 and I'm wondering what is the most common practice to "manage" shaders.
I'm asking this question because in the examples I've found (like the one included in the API ...
5
votes
1answer
272 views
Performance of pixel shaders vs. SpriteBatch: XNA
Precondition: I read this question/answer about using shaders, or spritebatch, to render and mark a sprite.
I need to do something like that. I also have a 2D lighting PoC which I need to write. The ...
2
votes
1answer
200 views
How can I pass an array of floats to the fragment shader using textures?
I want to map out a 2D array of depth elements for the fragment shader to use to check depth against to create shadows. I want to be able to copy a float array into the GPU, but using large uniform ...
1
vote
1answer
275 views
Low-level GPU code and Shader Compilation
Bear with me, because I will raise several questions at once. I still feel, though, that overall this can be treated as one question that may be answered succinctly.
I recently dove into solidifying ...
1
vote
2answers
161 views
How to shade a texture two different colors?
To give an example of what I'm asking about, I'll use Saints Row 3 since I've been playing that lately. In that game you can customize your looks and your car's appearance a lot. Your coat can have ...
2
votes
1answer
621 views
Blur shader without render textures?
Is it possible to append a blur shader to a standard (diffuse) shader ? I am looking for a way to do this as Unity indie doesn't allow render textures.
2
votes
1answer
239 views
Rendering different materials in a voxel terrain
Each voxel datapoint in my terrain model is made up of two properties: density and material type. Each is stored as an unsigned integer value (but the density is interpreted as a decimal value ...
1
vote
2answers
204 views
Deferred rendering order?
There are some effects for which I must do multi-pass rendering. I've got the basics set up (FBO rendering etc.), but I'm trying to get my head around the most suitable setup. Here's what I'm ...
2
votes
1answer
285 views
shader coding: calculate screen coordinates of fragment
Good morning,
I'm new to shader coding and trying to implement some visual effects code in shaders using billboards. (Yes, I couldn't have picked anything harder to start with, but I'm lucky that way)
...
11
votes
1answer
571 views
Toon/cel shading with variable line width?
I see a few broad approaches out there to doing cel shading:
Duplication & enlargement of model with flipped normals (not an option for me)
Sobel filter / fragment shader approaches to edge ...
3
votes
0answers
195 views
Suitability of ground fog using layered alpha quads?
A layered approach would use a series of massive alpha-textured quads arranged parallel to the ground, intersecting all intervening terrain geometry, to provide the illusion of ground fog quite ...
0
votes
2answers
219 views
How can I capture every frame in DirectX 9 using a shader
This is actually a follow up to this question
How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile
The proponent of the best solution suggested that I ...
0
votes
0answers
83 views
Opengl binding shaders vs binding buffers performance
Quick question for an opengl guru, I'm in the process of building a render queue and can either reduce the number of shader binding or the number of vertex buffer binding. I just want to know which ...
-1
votes
1answer
206 views
New to CG shader programming, what program should I use to write and test them? [closed]
I have started witting some shaders. First ones were fairly easy to write in notepad but now I need something with a bit more meat. I have checked rendermonnkey that seems to support CG but it is ...
1
vote
2answers
314 views
HLSL Pixel Shader that does palette swap
I have implemented a simple pixel shader which can replace a particular colour in a sprite with another colour.
It looks something like this:
sampler input : register(s0);
float4 ...
1
vote
0answers
130 views
loading a heightmap as texture in shader
I have a height map of 256x256, containing, foreach cell, not only height as a normal float value ( not 0-1 ) and also 2 gradient values ( for X and Y ), also as normal float values ( not 0-1 ).
I ...
2
votes
1answer
175 views
Using Ogre particle point billboards with shaders
I'm learning about using Ogre particles and had some questions about how the point type particles work.
Q. I believe point type particles are implemented as a single position. Is one single vertex is ...
2
votes
0answers
240 views
Where is the Shader Designer?
I have VS2012 Ultimate and I've been trying to access (find) the Shader Designer. I searched through MSDN's text and Channel9's videos, but they keep failing to mention how to access it...
Can ...
1
vote
0answers
289 views
Need help transforming DirectX 9 skybox hlsl shader to DirectX 11
I am in the middle of implementing a skybox to my game. I have been following this tutorial http://rbwhitaker.wikidot.com/skyboxes-2. I am using MonoGame as a framework and in order to support both ...
1
vote
1answer
189 views
XNA Shader Texture Memory
I was wondering about texture optimization in XNA 4.0.
Will the the contentmanager send the texturedata to the GPU directly when the texture gets loaded or do I send the texture data to the GPU when ...
1
vote
0answers
564 views
ssao implementation
I try to implement a ssao based on this tutorial: link I use a deferred rendering and world coordinates for shading calculations. When saving gbuffer a vertex shader output looks like this:
...
0
votes
1answer
224 views
Calculating distance from viewer to object in a shader
Good morning,
I'm working through creating the spherical billboards technique outlined in this paper. I'm trying to create a shader that calculates the distance from the camera to all objects in the ...
0
votes
2answers
132 views
GPU optimization question: pre-computed or procedural?
Good morning,
I'm learning shader program and need some general direction.
I want to add noise to my laser beam (like this).
Which is the best way to handle it?
I could pre-compute an image and pass ...
0
votes
2answers
239 views
LWJGL - OpenGL - Texture shading
I want to use LWJGL to create a shader that all it does is change the color of the given texture. For example I tell it to draw the letter A using a sprite sheet then I can tell the shader to draw the ...
3
votes
1answer
203 views
cocos2d mask rotation
I've been experimenting with Ray Wenderlich's tutorial about masking sprite using shaders with cocos2D 2.0.
It works pretty well but now I'd like to rotate the mask independently of the masked ...
2
votes
1answer
232 views
assigning values to shader parameters in the XNA content pipeline
I have tried creating a simple content processor that assigns the custom effect I created to models instead of the default BasicEffect.
[ContentProcessor(DisplayName = "Shadow Mapping Model")]
public ...
3
votes
1answer
482 views
Monogame/SharpDX - Shader parameters missing
I am currently working on a simple game that I am building in Windows 8 using MonoGame (develop3d). I am using some shader code from a tutorial (made by Charles Humphrey) and having an issue ...
10
votes
4answers
886 views
How can I acheive a smooth 2D lighting effect?
I'm making a 2D tile based game in XNA.
Currently my lightning looks like this.
How can I get it to look like this?
Instead of each block having its own tint, it has a smooth overlay.
I'm assuming ...
0
votes
0answers
84 views
How to move a directional light according to the camera movement?
Given a light direction, how can I move it according to the camera movement, in a shader?
Think that an artist has setup a scene (e.g., in 3DSMax) with a mesh in center of that and a directional ...
1
vote
1answer
1k views
How to make 2D water like in this video?
I wanna make water and waves for my little 2D PC game like in this video:
http://www.youtube.com/watch?v=ooU6cTeirlQ
I don't know how to write a similar shader. Does anybody know how to write a ...
