All Questions
41 questions
1
vote
0
answers
31
views
How to calculate Gertner waves normals?
I'm unable to properly calculate the normals for gertner waves following the Nvidia article
vec3 get_wave(vec4 wave, vec2 direction,vec3 vtx)
{
// x = SPEED, y = WAVELENGTH, z = AMPLITUDE, w = ...
0
votes
0
answers
42
views
HLSL Shader, Unreal- Float seems to cause performance problems
I'm building a shader in Unreal using HLSL, and the final piece of it looks something like this-
// Check un-overlapped ranges
for (int r = 0; r < range_count; r++) {
if (combined_spheres[r].y !...
0
votes
1
answer
518
views
How make shader for dashed outline of rounded rectangle?
How make dashed outline for rounded rectangle like in figma?
I tried wrote this, but I did only part with rounded rectangle and outline based on subtraction two rounded rectangles with different ...
0
votes
0
answers
343
views
Unity does not consistently provide reflection probe colors in surface shaders
For some mysterious reason, only at certain camera positions/angles, a boilerplate surface shader does not properly return a color from unity_SpecCube0. It either returns pure black, or pure white, ...
2
votes
0
answers
57
views
Holodeck effect: Surface shader only partially blocking surfaces behind it?
I am attempting to write a cubemap shader that can be applied to any geometry, with the goal to create a Holodeck-like effect. This shader would be applied to the walls/floor/ceiling of a room, and ...
0
votes
1
answer
200
views
Detect single channel texture in pixel shader
Is it possible to detect when a format has a single channel in HLSL or GLSL? Or just as good, is it possible to extract a greyscale color from such a texture without knowing if it has a single channel ...
2
votes
1
answer
153
views
How to step through 3D noise for volume textures?
I'm creating volume textures for volumetric ray marching (Creating this with Unity and a fragment shader)
Example
I have depth value that increases the starting position on the x, y or z axis.
Doing ...
0
votes
1
answer
184
views
Discarding pixels in ps_2_0?
Everything I looked up online indicates it does microsoft documents etc (but doesn't mention version)... but when I do this code:
float4 main(in float4 mXYZ : POSITION,in float4 mColor : COLOR0,in ...
0
votes
1
answer
232
views
Textures do not get accessed properly in pixel shader (DirectX11)
Textures are not being used by the pixel shader correctly. I am loading two separate textures in my pixel shader. However, most of the time, I can only ever display Texture1, even when I am trying to ...
0
votes
1
answer
312
views
How to allow an overlapping object's edge to show in front of another object with the same shader?
This is what it looks like currently, but I want the black outline to outline the whole sphere when in front of the other object in the scene. OverlappingShadedObjects.jpg
Here is my shader coder:
...
0
votes
1
answer
209
views
Having trouble converting a d3d9 pixelshader to d3d11
I've got this pixel shader that I'm trying to convert. I've corrected all the syntax for d3d11 but when I run the HLSL file through the compiler that spits out the .fxc file, it gives me this error:
...
0
votes
1
answer
967
views
Collision checking in pixel shader
I'm implementing kind of 3D Model tools using DirectX 11 and I need to paint the collision area between 2 meshes with Pixel-level accuracy.
So I think I should do something in pixel shader but I don't ...
1
vote
1
answer
581
views
C# WPF Brush to Blur the Canvas
I have a canvas in which I add a child image element.
<Canvas SnapsToDevicePixels="True" Width="56160" Height="37440">
<Image Width="56160" Height="37440" x:Name="OverlayImage"/>
</...
2
votes
1
answer
2k
views
Unity 3d Sprite Shader (How do I limit Max Brightness to 1 with Multiple Lights Hitting)
I am creating a videogame in Unity. Every sprite is rendered with a Sprite Renderer with a Material that has the CornucopiaShader.shader. The problem I have is I want to limit the max brightness (or ...
1
vote
1
answer
3k
views
Combining Two Shaders into One Shader
Unity Project, Want to combine these two shaders into one shader to get both of their functionality. One shader is for lighting, the other shader is for rendering better. How do I combine?
Shader "...
0
votes
1
answer
636
views
Tex2D returns interpolated values when off pixel center in HLSL
The Tex2D function returns interpolated values when off pixel center ((0.5, 0.5) for instance), this is really a problem when you have a large texture like 1920x1080.
I have an HLSL pixel shader ...
0
votes
0
answers
207
views
HLSL lighting based on texture pixels instead of screen
In HLSL, how can I calculate lighting based on pixels of a texture, instead of pixels that make up the object?
In other words, if I have a 64x64px texture being rendered on a 1024x768px screen, I ...
0
votes
1
answer
357
views
Comparison operations in HLSL
I am reading through a HLSL implementation of CSM shadow mapping and have come across a line of code i don't quite understande
float3 pos;
float3 CascadeDistances;
...
float3 weights = ( pos.z < ...
1
vote
0
answers
379
views
implement smoothing methods in fragment shader in unity
i'm trying to make a smoothed model from a 3d texture in unity3d game engine.
but problem is here, the model is not smoothed and the slices are obviously visible , i also had some changes on my shader ...
0
votes
1
answer
1k
views
PSSetSamplers doens't work (The Pixel Shader unit expects a Sampler)
I'm very new at directx11, and I wanted to add texture to a shader I'm using.
(until now, I hadn't used any texture yet in directx11)
But sampling doesn't seem to work (it's always float4(0,0,0,0)), ...
3
votes
1
answer
5k
views
How to make Unity glass shader only refract objects behind it?
I am looking for a glass shader for Unity that only refracts the objects behind it, or ideas for how to modify an existing glass shader to do that.
This screenshot shows what happens when I use FX/...
2
votes
1
answer
2k
views
Why won't this HLSL Pixel Shader compile when RWStructuredBuffer is referenced?
I'm using DirectX 12, trying to render using UAVs. Here is my pixel shader code:
struct PSInput
{
float4 position : SV_POSITION;
float4 color : COLOR;
};
struct FragmentDataStruct
{
...
0
votes
1
answer
2k
views
HLSL fragment shader different color for every vertex?
can i make different colors for every vertex instance of this shader? do i have to send instance to o.output to the frag color? It's the Unity3d implementation of HLSL running Graphics.DrawProcedural (...
0
votes
1
answer
162
views
Invisible edges when applying pixel shader to model
I am currently working on a simple shader in hlsl. What I am trying to achieve is 'highlight' effect when cursor is placed on the object in my screen. My issue is that, the pixel shader doesn't work ...
2
votes
1
answer
2k
views
Vertex to Pixel Shader TEXCOORD interpolation precision issues
I think I'm experiencing precision issues in the pixel shader when reading the texcoords that's been interpolated from the vertex shader.
My scene constists of some very large triangles (edges being ...
0
votes
1
answer
1k
views
issues converting HLSL shader to shaderLab
I've been working on a project which involves me working with shader coding something I'm not familiar with. I've been provided some HLSL code from another team member and have been trying to ...
0
votes
2
answers
56
views
XNA Unexpected ')' Effect Compiler [closed]
My XNA HLSL Compiler keeps telling that I have unexpected ')' at the end of a subtraction.
The PixelShader:
float3 lightDir = normalize(LightDirection);
float3 viewDir = normalize(input.View);
float3 ...
1
vote
1
answer
2k
views
Emulating Photoshop Opacity Mask to HLSL ShaderEffect
I am trying to write a HLSL to emulate the Photoshop's opacity mask: White translate to Alpha=1(opaque), Black translate to Alpha=0(transparent) and shades of gray will translate to the range of ...
5
votes
3
answers
2k
views
Optimization of HLSL shader
I have the problem that the below pixel shader (HLSL) compiles to 68 instructions (with the below suggested optimizations). However, I would like to use it with shader model 2 and therefore ...
1
vote
1
answer
2k
views
HLSL Texture sample fine when directly returned, invalid if any operation is applied
I am new to shaders and HLSL, I hope I'm not doing anything seriously incorrect. I am trying to blend two textures in HLSL. I've got both of my textures and samplers set up:
Texture2D<float4> ...
0
votes
1
answer
2k
views
Math behind Tex2D in HLSL
Could someone explain the math behind the function Tex2D in HLSL?
One of the examples is: given a quad with 4 vertices, the texture coordinates are (0,0) (0,1) (1,0) (1,1) on it and the texture's ...
1
vote
2
answers
5k
views
How to manually or automatically optimize HLSL (pixel) shader code?
What are successful strategies to optimize HLSL shader code in terms of computational complexity (meaning: minimizing runtime of the shader)?
I guess one way would be to minimize the number of ...
0
votes
1
answer
3k
views
Error when writing a very simple HLSL pixel shader
I am writing I SlimDX application to test color contrast sensitivity thresholds of the human visual system. The subject is presented with a large letter that is at low contrast with with the ...
11
votes
4
answers
13k
views
What kind of blurs can be implemented in pixel shaders?
Gaussian, box, radial, directional, motion blur, zoom blur, etc.
I read that Gaussian blur can be broken down in passes that could be implemented in pixel shaders, but couldn't find any samples.
Is ...
11
votes
1
answer
7k
views
pow(0, 2.2) gives 1 in a hlsl pixel shader?
But pow(0, 2.0) gives 0
Seems that any float exponent gives 1 while integer exponents give 0.
I am using DirectX 9 and hlsl compiler "D3DCompiler_43.dll".
Confirmed that on Nvidia and Ati cards.
I ...
0
votes
2
answers
1k
views
Multiple Effect on the sprite
I have implement the effect and Transition using pixel shader files. When i apply effect and transition separately it working fine, but if i am applying both simultaneously it is not working. How can ...
0
votes
1
answer
1k
views
Help to understand Pixelate effect
I'm new a HLSL and I'm trying to understand a pixelate sample. However, I haven't been able to find a reference about how a couple of operations are. Here is the shader example:
//--------------------...
12
votes
1
answer
8k
views
How much performance do conditionals and unused samplers/textures add to SM2/3 pixel shaders?
We've one pixel shader in HLSL which is used for slightly different things in a few places, and as such has several conditional blocks meaning that complex functionality is omitted in some cases. As ...
2
votes
1
answer
641
views
Use shaders to compare images
Do you know how can I write simple shader (hlsl) to compare two images ? I want to get on result percent of similarity ? Is it posible to use shaders in this case ? Can I for example count red pixels ...
1
vote
3
answers
2k
views
HLSL Translucent Plastic Shader
I'm trying to produce a shader to replicate a white plastic object with a colored light inside. Either by having a shader that will be translucent and if I put a light inside the object the light will ...
2
votes
3
answers
5k
views
HLSL How can one pass data between shaders / read existing colour value?
I have 2 HLSL ps2.0 shaders. Simplified, they are:
Shader 1
Reads texture
Outputs colour value based on this texture
Shader 2
Problem: Need to read in the colour from Shader 1
Outputs the final ...