3Dmigoto now open-source...
  98 / 141    
[quote="DarkStarSword"] I doubt it will work, but you might try making the resource fully typed just to see if that satisfies DirectX - try adding format=R24_UNORM_X8_TYPELESS to your [CustomResource] section. I'd be quite surprised if that works, but you never know - DirectX is weird. [/quote] I've tried that first, but no hope. [quote="DarkStarSword"] I think your best bet is to try using the resource as a depth target instead of a render target, which should set bind flags that DirectX is happy with - you can still use oDepth to write to it from a pixel shader. [/quote] I've set oD = ref ResourceDepthBufferHalf if I understand it properly, but all objects apart from what I was drawing turned red. I'm not quite sure what should I do in the ps to write to the DB, and what about o0? copy/restore or leave it alone? The third option is not clear to me at all :)
DarkStarSword said:
I doubt it will work, but you might try making the resource fully typed just to see if that satisfies DirectX - try adding format=R24_UNORM_X8_TYPELESS to your [CustomResource] section. I'd be quite surprised if that works, but you never know - DirectX is weird.

I've tried that first, but no hope.

DarkStarSword said:
I think your best bet is to try using the resource as a depth target instead of a render target, which should set bind flags that DirectX is happy with - you can still use oDepth to write to it from a pixel shader.

I've set oD = ref ResourceDepthBufferHalf if I understand it properly, but all objects apart from what I was drawing turned red. I'm not quite sure what should I do in the ps to write to the DB, and what about o0? copy/restore or leave it alone?

The third option is not clear to me at all :)

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/04/2017 07:37 PM   
[quote="DarkStarSword"] Worth noting though that the "W Buffer" is *NOT* a depth buffer. It is in the logical sense that it has depth values, but not in the DirectX sense that it is something using a D*S* format assigned to a depth/stencil target that is used for depth and/or stencil tests and holds logarithmic depth values. It is just a generic render target that the game (or more precisely, nvidia's ambient occlusion shader) has written linear depth values to.[/quote] Oh, so it's a depth buffer processed in the pixel shader. That explains my confusion, thanks.
DarkStarSword said:
Worth noting though that the "W Buffer" is *NOT* a depth buffer. It is in the logical sense that it has depth values, but not in the DirectX sense that it is something using a D*S* format assigned to a depth/stencil target that is used for depth and/or stencil tests and holds logarithmic depth values. It is just a generic render target that the game (or more precisely, nvidia's ambient occlusion shader) has written linear depth values to.


Oh, so it's a depth buffer processed in the pixel shader. That explains my confusion, thanks.

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/04/2017 07:40 PM   
I've tried [code]void main(float4 pos : SV_Position0, out float result : SV_Depth0)[/code] but nothing is written to the DB
I've tried
void main(float4 pos : SV_Position0, out float result : SV_Depth0)

but nothing is written to the DB

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/04/2017 08:05 PM   
Here is my complete water shader. It had *some* ups and downs, but eventually it's done. Well, almost, apart from its terrible performance and the noisy SS reflections. That's what I was hoping the depth buffer downscaling will eliminate. That video demo only shows the water mod applied, all the rest is disabled for this moment. [url]https://youtu.be/yTtPwM77UXs[/url]
Here is my complete water shader. It had *some* ups and downs, but eventually it's done. Well, almost, apart from its terrible performance and the noisy SS reflections. That's what I was hoping the depth buffer downscaling will eliminate.

That video demo only shows the water mod applied, all the rest is disabled for this moment.
https://youtu.be/yTtPwM77UXs

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/04/2017 08:38 PM   
I was thinking as a last resort about packing the downscaled DB in the custom shader into o0.xyz and then unpacking it in the shader where I sample the downscaled one. I hope we could find some more elegant way though.
I was thinking as a last resort about packing the downscaled DB in the custom shader into o0.xyz and then unpacking it in the shader where I sample the downscaled one. I hope we could find some more elegant way though.

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/04/2017 09:55 PM   
In some ways you might be better off just converting it to a render target anyway - unless you actually want to assign it to the depth/stencil stage for some reason, but I gather you're just sampling from it as a texture which wouldn't need that? Try converting the format to R32_FLOAT - I'm pretty sure I've used that with render targets before - in fact I must have come across this before, because I left this comment for myself in The Witness: [code] [ResourceDepthBufferPuzzles] ; Depth buffer format cannot be used as a render target, so override it: format = R32_FLOAT [/code]
In some ways you might be better off just converting it to a render target anyway - unless you actually want to assign it to the depth/stencil stage for some reason, but I gather you're just sampling from it as a texture which wouldn't need that? Try converting the format to R32_FLOAT - I'm pretty sure I've used that with render targets before - in fact I must have come across this before, because I left this comment for myself in The Witness:

[ResourceDepthBufferPuzzles]
; Depth buffer format cannot be used as a render target, so override it:
format = R32_FLOAT

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 08/05/2017 01:12 AM   
[quote="Oomek"]That video demo only shows the water mod applied, all the rest is disabled for this moment. [url]https://youtu.be/yTtPwM77UXs[/url][/quote]That looks awesome :)
Oomek said:That video demo only shows the water mod applied, all the rest is disabled for this moment.
https://youtu.be/yTtPwM77UXs
That looks awesome :)

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 08/05/2017 01:14 AM   
[quote="DarkStarSword"]In some ways you might be better off just converting it to a render target anyway - unless you actually want to assign it to the depth/stencil stage for some reason, but I gather you're just sampling from it as a texture which wouldn't need that? Try converting the format to R32_FLOAT - I'm pretty sure I've used that with render targets before - in fact I must have come across this before, because I left this comment for myself in The Witness: [code] [ResourceDepthBufferPuzzles] ; Depth buffer format cannot be used as a render target, so override it: format = R32_FLOAT [/code][/quote] It worked :) ...however... yes there is always that word ruining the day :) First pass works flawlessly, but the second one is shifted so the whole reflection goes up. [code][ResourceDepthBuffer] max_copies_per_frame=1 [ResourceDepthBufferHalf] width_multiply = 0.5 height_multiply = 0.5 format = R32_FLOAT [ResourceDepthBufferQuarter] width_multiply = 0.25 height_multiply = 0.25 format = R32_FLOAT [CustomShaderDownsampleDB] vs = ShaderFixes\downscale.vs.hlsl ps = ShaderFixes\downscale.ps.hlsl blend = disable cull = none topology = triangle_strip ResourceDepthBufferHalf = copy_desc ResourceDepthBuffer o0 = ref ResourceDepthBufferHalf ps-t100 = ref ResourceDepthBuffer draw = 4, 0 ResourceDepthBufferQuarter = copy_desc ResourceDepthBuffer o0 = ref ResourceDepthBufferQuarter ps-t100 = ref ResourceDepthBufferHalf draw = 4, 0 post ps-t100 = null[/code]
DarkStarSword said:In some ways you might be better off just converting it to a render target anyway - unless you actually want to assign it to the depth/stencil stage for some reason, but I gather you're just sampling from it as a texture which wouldn't need that? Try converting the format to R32_FLOAT - I'm pretty sure I've used that with render targets before - in fact I must have come across this before, because I left this comment for myself in The Witness:

[ResourceDepthBufferPuzzles]
; Depth buffer format cannot be used as a render target, so override it:
format = R32_FLOAT


It worked :) ...however... yes there is always that word ruining the day :)
First pass works flawlessly, but the second one is shifted so the whole reflection goes up.

[ResourceDepthBuffer]
max_copies_per_frame=1

[ResourceDepthBufferHalf]
width_multiply = 0.5
height_multiply = 0.5
format = R32_FLOAT

[ResourceDepthBufferQuarter]
width_multiply = 0.25
height_multiply = 0.25
format = R32_FLOAT

[CustomShaderDownsampleDB]
vs = ShaderFixes\downscale.vs.hlsl
ps = ShaderFixes\downscale.ps.hlsl
blend = disable
cull = none
topology = triangle_strip

ResourceDepthBufferHalf = copy_desc ResourceDepthBuffer
o0 = ref ResourceDepthBufferHalf
ps-t100 = ref ResourceDepthBuffer
draw = 4, 0

ResourceDepthBufferQuarter = copy_desc ResourceDepthBuffer
o0 = ref ResourceDepthBufferQuarter
ps-t100 = ref ResourceDepthBufferHalf
draw = 4, 0

post ps-t100 = null

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/05/2017 04:04 AM   
update: I forgot to scale indices in one place, all is good now, thank you.
update: I forgot to scale indices in one place, all is good now, thank you.

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/05/2017 04:39 AM   
Is this scenario allowed in 3DM? [code][ResourceBackup] [ResourceHalf] width_multiply = 0.5 height_multiply = 0.5 [CustomShaderHalf] ResourceBackup = ref o0 ps = ShaderFixes\2e73a7906782429e-ps_replace_Half.txt ResourceHalf= copy_desc o0 o0 = ResourceHalf draw = from_caller post o0 = ref ResourceBackup [ShaderOverride-tessellation.ds] hash = 0dda525743cd4f5d run = CustomShaderHalf [ShaderOverride-FullSize] hash = 3ce369598f34925e ps-t101 = ResourceHalf post ps-t101 = null [/code] I'm trying to draw one pixel shader called from the domain shader after tessellation pass in half the resolution to a custom resource and then use it as a texture in the original shader. Unfortunately it seems like the vertices are clipped to quarter of the screen, do I have to scale the vertices somehow as well, or width_multiply and height_multiply is possible to use only with the custom vertex shader? Edit: The answer is to change o0 = ResourceHalf to o0 = set_viewport ResourceHalf
Is this scenario allowed in 3DM?

[ResourceBackup]

[ResourceHalf]
width_multiply = 0.5
height_multiply = 0.5

[CustomShaderHalf]
ResourceBackup = ref o0
ps = ShaderFixes\2e73a7906782429e-ps_replace_Half.txt
ResourceHalf= copy_desc o0
o0 = ResourceHalf
draw = from_caller
post o0 = ref ResourceBackup

[ShaderOverride-tessellation.ds]
hash = 0dda525743cd4f5d
run = CustomShaderHalf

[ShaderOverride-FullSize]
hash = 3ce369598f34925e
ps-t101 = ResourceHalf
post ps-t101 = null


I'm trying to draw one pixel shader called from the domain shader after tessellation pass in half the resolution to a custom resource and then use it as a texture in the original shader.

Unfortunately it seems like the vertices are clipped to quarter of the screen, do I have to scale the vertices somehow as well, or width_multiply and height_multiply is possible to use only with the custom vertex shader?

Edit: The answer is to change
o0 = ResourceHalf
to
o0 = set_viewport ResourceHalf

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/06/2017 04:29 PM   
Solved in chat, but for anyone else following along at home the solution was to unbind the depth buffer and set the viewport to match the new render target: [code] oD = null o0 = set_viewport ResourceHalf [/code]
Solved in chat, but for anyone else following along at home the solution was to unbind the depth buffer and set the viewport to match the new render target:

oD = null
o0 = set_viewport ResourceHalf

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 08/07/2017 05:17 PM   
Does 3DM give the ability to render an additional depth buffer but with the face culling swapped, so I can subtract it from the normal db and get the geometry thickness if game doesn't provide that?
Does 3DM give the ability to render an additional depth buffer but with the face culling swapped, so I can subtract it from the normal db and get the geometry thickness if game doesn't provide that?

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/09/2017 08:20 PM   
That's not something I've thought about, but yeah you can probably do it using a custom shader with cull=front (related options: cull=back, cull=none, front=clockwise, front=counterclockwise) and your own depth target, and trigger it from anything you need to measure.
That's not something I've thought about, but yeah you can probably do it using a custom shader with cull=front (related options: cull=back, cull=none, front=clockwise, front=counterclockwise) and your own depth target, and trigger it from anything you need to measure.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 08/10/2017 07:31 AM   
What if I wanted to measure thickness of all the objects in the scene?
What if I wanted to measure thickness of all the objects in the scene?

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/10/2017 08:45 AM   
Is there any way to force anisotropic filtering in the game driver profile?
Is there any way to force anisotropic filtering in the game driver profile?

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 08/10/2017 10:52 AM   
  98 / 141    
Scroll To Top