Jump to content
  • Advertisement

MikhailGorobets

Member
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

0 Neutral

About MikhailGorobets

  • Rank
    Member

Personal Information

  • Role
    Student
  • Interests
    Education
    Programming

Social

  • Github
    IBets

Recent Profile Visitors

462 profile views
  1. MikhailGorobets

    Shader swapping problem

    You can create several layers. Let's say 10 and give each level a depth [0,1]. And then each widget is assigned the appropriate level. So you don't need to sort objects. And you can activate the widget by changing the depth value. Use perspective matrix
  2. MikhailGorobets

    Open-World Survival Game Project

    I graphics programmer. This my graphics demo https://github.com/IBets/RenderAPI, but is't complete.
  3. MikhailGorobets

    Compact YCoCg Frame Buffer

    Thanks you
  4. MikhailGorobets

    Optimizing compute shader, many textures

    I think it's better to create one buffer and update it. This take less time for synchronizing between CPU and GPU
  5. How to unpack the frame buffer when packing by Compact YCoCg Frame Buffer?
  6. MikhailGorobets

    HDR tonemapping/exposure values

    Yes. I have to count the general lighting of the scenes and divide into this co-factor. I've just picked it up
  7. MikhailGorobets

    HDR tonemapping/exposure values

    I do so Texture2D<float4> TexHDR : register(t0); static const float3 LUM_FACTOR = float3(0.299, 0.587, 0.114); float3 ToneMapping(float3 HDRColor) { float LScale = dot(HDRColor, LUM_FACTOR); LScale *= MiddleGrey / 0.01; LScale = (LScale + LScale * LScale / LumWhiteSqr) / (1.0 + LScale); return HDRColor * LScale; }
  8. MikhailGorobets

    Geometry shader error

    No. I don't set Position:SV_Position, Texcoord : TEXCOORD
  9. MikhailGorobets

    Geometry shader error

    error X3502: 'main': input parameter 'input' missing semantics #include "Common.hlsli" struct PSInput { float4 Position; float2 Texcoord; }; PSInput OffsetNProjected(PSInput data, float2 offset, float2 texcoord) { data.Position.xy += offset; data.Position = mul(data.Position, Project); data.Texcoord = texcoord; return data; } [maxvertexcount(4)] void main(point PSInput input[1], inout TriangleStream<PSInput> stream) { PSInput output = input[0]; const float size = 0.1f; stream.Append(OffsetNProjected(output, float2(-1, -1) * size, float2(0, 0))); stream.Append(OffsetNProjected(output, float2(-1, -1) * size, float2(0, 1))); stream.Append(OffsetNProjected(output, float2(1, -1) * size, float2(1, 0))); stream.Append(OffsetNProjected(output, float2(1, 1) * size, float2(1, 1))); stream.RestartStrip(); }
  10. I have a problem with SSAO. On left hand black area. Code shader: Texture2D<uint> texGBufferNormal : register(t0); Texture2D<float> texGBufferDepth : register(t1); Texture2D<float4> texSSAONoise : register(t2); float3 GetUV(float3 position) { float4 vp = mul(float4(position, 1.0), ViewProject); vp.xy = float2(0.5, 0.5) + float2(0.5, -0.5) * vp.xy / vp.w; return float3(vp.xy, vp.z / vp.w); } float3 GetNormal(in Texture2D<uint> texNormal, in int3 coord) { return normalize(2.0 * UnpackNormalSphermap(texNormal.Load(coord)) - 1.0); } float3 GetPosition(in Texture2D<float> texDepth, in int3 coord) { float4 position = 1.0; float2 size; texDepth.GetDimensions(size.x, size.y); position.x = 2.0 * (coord.x / size.x) - 1.0; position.y = -(2.0 * (coord.y / size.y) - 1.0); position.z = texDepth.Load(coord); position = mul(position, ViewProjectInverse); position /= position.w; return position.xyz; } float3 GetPosition(in float2 coord, float depth) { float4 position = 1.0; position.x = 2.0 * coord.x - 1.0; position.y = -(2.0 * coord.y - 1.0); position.z = depth; position = mul(position, ViewProjectInverse); position /= position.w; return position.xyz; } float DepthInvSqrt(float nonLinearDepth) { return 1 / sqrt(1.0 - nonLinearDepth); } float GetDepth(in Texture2D<float> texDepth, float2 uv) { return texGBufferDepth.Sample(samplerPoint, uv); } float GetDepth(in Texture2D<float> texDepth, int3 screenPos) { return texGBufferDepth.Load(screenPos); } float CalculateOcclusion(in float3 position, in float3 direction, in float radius, in float pixelDepth) { float3 uv = GetUV(position + radius * direction); float d1 = DepthInvSqrt(GetDepth(texGBufferDepth, uv.xy)); float d2 = DepthInvSqrt(uv.z); return step(d1 - d2, 0) * min(1.0, radius / abs(d2 - pixelDepth)); } float GetRNDTexFactor(float2 texSize) { float width; float height; texGBufferDepth.GetDimensions(width, height); return float2(width, height) / texSize; } float main(FullScreenPSIn input) : SV_TARGET0 { int3 screenPos = int3(input.Position.xy, 0); float depth = DepthInvSqrt(GetDepth(texGBufferDepth, screenPos)); float3 normal = GetNormal(texGBufferNormal, screenPos); float3 position = GetPosition(texGBufferDepth, screenPos) + normal * SSAO_NORMAL_BIAS; float3 random = normalize(2.0 * texSSAONoise.Sample(samplerNoise, input.Texcoord * GetRNDTexFactor(SSAO_RND_TEX_SIZE)).rgb - 1.0); float SSAO = 0; [unroll] for (int index = 0; index < SSAO_KERNEL_SIZE; index++) { float3 dir = reflect(SamplesKernel[index].xyz, random); SSAO += CalculateOcclusion(position, dir * sign(dot(dir, normal)), SSAO_RADIUS, depth); } return 1.0 - SSAO / SSAO_KERNEL_SIZE; }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!