hlsl

Unity Shader - How to efficiently recolor specific coordinates?

做~自己de王妃 提交于 2021-02-08 13:23:50
问题 First, please allow me to explain what I've got and then I'll go over what I'm trying to figure out next. What I've got I've got a textured custom mesh with some edges that exactly align with integer world coordinates in Unity. To the mesh I've added my own crude yet effective custom surface shader that looks like this: Shader "Custom/GridHighlightShader" { Properties { [HideInInspector]_SelectionColor("SelectionColor", Color) = (0.1,0.1,0.1,1) [HideInInspector]_MovementColor("MovementColor",

D3D11: variable number of lights in HLSL

戏子无情 提交于 2021-02-07 08:17:22
问题 I'm working on a game engine in C++ and Direct3D11 and I want now to add a variable number lights to the scene. Up to date, I managed to add and render simple lights of a count that was already known and coded in the shader programs. In shader.fx: static const int LightsCount= 4; struct NF3D_LIGHT { // Members... }; cbuffer Light : register(b5) { NF3D_LIGHT light[LightsCount]; }; ... // And the pixel shader function: float4 PS(PS_INPUT input) : SV_Target { for(int i = 0; i < LightsCount; i++)

D3D11: variable number of lights in HLSL

你离开我真会死。 提交于 2021-02-07 08:16:35
问题 I'm working on a game engine in C++ and Direct3D11 and I want now to add a variable number lights to the scene. Up to date, I managed to add and render simple lights of a count that was already known and coded in the shader programs. In shader.fx: static const int LightsCount= 4; struct NF3D_LIGHT { // Members... }; cbuffer Light : register(b5) { NF3D_LIGHT light[LightsCount]; }; ... // And the pixel shader function: float4 PS(PS_INPUT input) : SV_Target { for(int i = 0; i < LightsCount; i++)

hls generated with gst (ts m3u8) not playing on safari (but working on chrome)

混江龙づ霸主 提交于 2020-12-15 05:34:42
问题 i'm trying to use gst to generate an hls video from frames within an existing pipeline. once i get the frame as a numpy array i use the following to create the ts and m3u8 file : appsrc emit-signals=True do-timestamp=true is-live=True caps={DEFAULT_CAPS}".format(**locals()) ! "queue" ! "videoconvert" ! "x264enc" ! "mpegtsmux" ! f"hlssink location={playlist}.%04d.ts " ! f"playlist-location={playlist}.m3u8"]) where default caps = "video/x-raw,format={VIDEO_FORMAT},width={WIDTH},height={HEIGHT}

Shader - Calculate depth relative to Object

◇◆丶佛笑我妖孽 提交于 2020-12-08 04:47:46
问题 I am trying to calculate depth relative to the object . Here is a good solution to retrieve depth relative to camera : Depth as distance to camera plane in GLSL varying float distToCamera; void main() { vec4 cs_position = glModelViewMatrix * gl_Vertex; distToCamera = -cs_position.z; gl_Position = gl_ProjectionMatrix * cs_position; } With this example the depth is relative to the camera . But I would like get the depth relative to the object. I would like the same depth and value if I am near

How to Invert Color of XAML PNG Images using C#?

霸气de小男生 提交于 2020-08-22 21:03:23
问题 I'm using Visual Studio, C#, XAML, WPF. In my program I have XAML buttons with white png icons. I want to have it so you can switch to a theme with black icons by choosing the theme from a ComboBox. Instead of creating a new set of black png images, is there a way with XAML and C# I can invert the color of the white icons? <Button x:Name="btnInfo" HorizontalAlignment="Left" Margin="10,233,0,0" VerticalAlignment="Top" Width="22" Height="22" Cursor="Hand" Click="buttonInfo_Click" Style="

NSight Graphics Debugging cannot start

冷暖自知 提交于 2020-04-30 07:43:26
问题 I am trying to debug a HLSL shader in VS2012 using NSight, but it can't start. When I click on "Start Graphics Debugging", it seems like it starts the app for a moment, and then closes it (output windows from NSight shows several "shader loaded"/"shader unloaded" lines). Windows Event log doesn't show anything (except "NVIDIA Network Service" failing to start, but if I understood well, this is something related to updates). On the other hand, if I start GPU Perfomannce analysis, then it runs