3Dmigoto now open-source...
  143 / 143    
Open mouse.hlsl, find this section: [code] // Draw a colour cursor, e.g. use "Windows Default" to test float4 draw_cursor_color(float2 texcoord, float2 dimensions) { float4 result; float mask; if (any(texcoord < 0 || texcoord >= dimensions)) return 0; result = cursor_color.Load(float3(texcoord, 0)); mask = cursor_mask.Load(float3(texcoord, 0)).x; // We may or may not have an alpha channel in the color bitmap, but // as far as I can tell Windows doesn't expose an API to check if the // cursor has an alpha channel or not, so we have no good way to know // (32bpp does not imply alpha). People on stackoverflow are scanning // the entire alpha channel looking for non-zero values to fudge this. // // If the alpha is 0 it may either mean there is an alpha channel and // this pixel should be fully transparent, or that there is no alpha // channel and this pixel should only use the AND mask for alpha. Let's // assume that alpha=0 means no alpha channel, which should work // provided the mask blanks out those pixels as well. // // If later we find a way to detect this in 3DMigoto we can use // Format=DXGI_FORMAT_B8G8R8X8_UNORM_SRGB to indicate there is no alpha // channel, which will cause the read here to return 1 for opaque. if (!result.w) result.w = 1; if (mask) result.w = 0; return result; } [/code] Read the comment. Marvel at how stupid Windows is and why this is even a problem, then comment out these two lines: [code] if (!result.w) result.w = 1; [/code]
Open mouse.hlsl, find this section:

// Draw a colour cursor, e.g. use "Windows Default" to test
float4 draw_cursor_color(float2 texcoord, float2 dimensions)
{
float4 result;
float mask;

if (any(texcoord < 0 || texcoord >= dimensions))
return 0;

result = cursor_color.Load(float3(texcoord, 0));
mask = cursor_mask.Load(float3(texcoord, 0)).x;

// We may or may not have an alpha channel in the color bitmap, but
// as far as I can tell Windows doesn't expose an API to check if the
// cursor has an alpha channel or not, so we have no good way to know
// (32bpp does not imply alpha). People on stackoverflow are scanning
// the entire alpha channel looking for non-zero values to fudge this.
//
// If the alpha is 0 it may either mean there is an alpha channel and
// this pixel should be fully transparent, or that there is no alpha
// channel and this pixel should only use the AND mask for alpha. Let's
// assume that alpha=0 means no alpha channel, which should work
// provided the mask blanks out those pixels as well.
//
// If later we find a way to detect this in 3DMigoto we can use
// Format=DXGI_FORMAT_B8G8R8X8_UNORM_SRGB to indicate there is no alpha
// channel, which will cause the read here to return 1 for opaque.

if (!result.w)
result.w = 1;

if (mask)
result.w = 0;

return result;
}

Read the comment. Marvel at how stupid Windows is and why this is even a problem, then comment out these two lines:

if (!result.w)
result.w = 1;

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 04/14/2019 03:06 PM   
Thanks it works. One more question. I tried to set cursor depth due to mouse coords and adjust_from_depth_buffer() (or adjust_from_stereo2mono_depth_buffer()) from crosshair.hlsl but it sets some depth dependable only from convergence and neither depth_buffer nor stereo2mono_depth_buffer. I've analysed crosshair.hlsl and saw that it uses register(t110) for z-buffer and register(b13) for some variables or structures. Is 3DMigoto copies them by default or I should change some *.ini files or add something in shaders?
Thanks it works. One more question. I tried to set cursor depth due to mouse coords and adjust_from_depth_buffer() (or adjust_from_stereo2mono_depth_buffer()) from crosshair.hlsl but it sets some depth dependable only from convergence and neither depth_buffer nor stereo2mono_depth_buffer. I've analysed crosshair.hlsl and saw that it uses register(t110) for z-buffer and register(b13) for some variables or structures. Is 3DMigoto copies them by default or I should change some *.ini files or add something in shaders?

Posted 04/14/2019 04:20 PM   
Maybe this link might help https://github.com/bo3b/3Dmigoto/wiki/Auto-Crosshair
Maybe this link might help

https://github.com/bo3b/3Dmigoto/wiki/Auto-Crosshair

Posted 04/14/2019 04:36 PM   
This link discribes how to send depth buffer via texture to crosshair's vertex shader with known hash. But in my case we should send it to crosshair.hlsl via d3dx.ini some way like that: [code] [ResourceDepthBuffer] [ShaderOverrideShadow] Hash = ... ResourceDepthBuffer = reference ps-t0 [/code]
This link discribes how to send depth buffer via texture to crosshair's vertex shader with known hash. But in my case we should send it to crosshair.hlsl via d3dx.ini some way like that:
[ResourceDepthBuffer]
[ShaderOverrideShadow]
Hash = ...
ResourceDepthBuffer = reference ps-t0

Posted 04/14/2019 06:00 PM   
It's seems to me that I've found something in Subnautica fix from DSS: [code] [Resource_CameraDepthTexture] max_copies_per_frame = 1 [i][u][CommandListHUD] vs-t110 = Resource_CameraDepthTexture vs-cb13 = Resource_UnityPerCamera post vs-t110 = null post vs-cb13 = null[/u][/i] [CommandListResetPerFrameLimits] reset_per_frame_limits = Resource_CameraDepthTexture [ShaderOverride_015eee9dc582e524 Patched by DarkStarSwords shader tools] allow_duplicate_hash = true hash = 015eee9dc582e524 ps-cb10 = Resource_Inverse_VP_CB Resource_CameraDepthTexture = ps-t0 Resource_UnityPerCamera = ps-cb1 [/code]
It's seems to me that I've found something in Subnautica fix from DSS:
[Resource_CameraDepthTexture]
max_copies_per_frame = 1
[CommandListHUD]
vs-t110 = Resource_CameraDepthTexture
vs-cb13 = Resource_UnityPerCamera
post vs-t110 = null
post vs-cb13 = null

[CommandListResetPerFrameLimits]
reset_per_frame_limits = Resource_CameraDepthTexture
[ShaderOverride_015eee9dc582e524 Patched by DarkStarSwords shader tools]
allow_duplicate_hash = true
hash = 015eee9dc582e524
ps-cb10 = Resource_Inverse_VP_CB
Resource_CameraDepthTexture = ps-t0
Resource_UnityPerCamera = ps-cb1

Posted 04/14/2019 06:21 PM   
Do not work. What I have: In unity_generated.ini a lot of shaders like that: [code] [ShaderOverride_04372989164348df Patched by DarkStarSwords shader tools] allow_duplicate_hash = true hash = 04372989164348df ps-cb10 = Resource\ShaderFixes\unity.ini\_Inverse_VP_CB [u][i][b]Resource\ShaderFixes\unity.ini\_CameraDepthTexture = ps-t0[/b][/i][/u] Resource\ShaderFixes\unity.ini\_UnityPerCamera = ps-cb1 [/code] in d3dx.ini: [code] [CommandListAutoCrosshair] [u][i][b]vs-t110 = Resource_CameraDepthTexture[/b][/i][/u] vs-cb13 = Resource_UnityPerCamera post vs-t110 = null post vs-cb13 = null [/code] in mouse.hlsl: [code] #include <crosshair.hlsl> ... [u][i][b]float2 mouse_pos = (cursor_window / window_size * 2 - 1); output.pos.x += adjust_from_depth_buffer(mouse_pos.x, mouse_pos.y);[/b][/i][/u] [/code] in crosshair.hlsl: [code] Texture2D<float4> DepthBuffer : register(t110); ... static const float near = 0.05; static const float far = 8000; ... [/code] So I even don't use register(b13) in calculations of crosshair.hlsl. From code analysis seems that DepthBuffer.Load(int3(x,y,0)).x always returns 1
Do not work. What I have:
In unity_generated.ini a lot of shaders like that:
[ShaderOverride_04372989164348df Patched by DarkStarSwords shader tools]
allow_duplicate_hash = true
hash = 04372989164348df
ps-cb10 = Resource\ShaderFixes\unity.ini\_Inverse_VP_CB
Resource\ShaderFixes\unity.ini\_CameraDepthTexture = ps-t0
Resource\ShaderFixes\unity.ini\_UnityPerCamera = ps-cb1

in d3dx.ini:
[CommandListAutoCrosshair]
vs-t110 = Resource_CameraDepthTexture
vs-cb13 = Resource_UnityPerCamera
post vs-t110 = null
post vs-cb13 = null

in mouse.hlsl:
#include <crosshair.hlsl>
...
float2 mouse_pos = (cursor_window / window_size * 2 - 1);
output.pos.x += adjust_from_depth_buffer(mouse_pos.x, mouse_pos.y);

in crosshair.hlsl:
Texture2D<float4> DepthBuffer : register(t110);
...
static const float near = 0.05;
static const float far = 8000;
...


So I even don't use register(b13) in calculations of crosshair.hlsl. From code analysis seems that DepthBuffer.Load(int3(x,y,0)).x always returns 1

Posted 04/14/2019 09:04 PM   
@DSS I've no idea if this might be useful to you or the other person messing with dds files MipKiller v1.0 Some games require UI textures with no mip-maps. This tool removes them from DDS files. https://frostytoolsuitedev.gitlab.io/downloads.html No idea what this is, but it's on the same page NormalCompleter v1.0 Do you have a normal map with only two channels of data? This tool will compute the third channel (Z) and fill it in! Also, you might look at the [url=https://github.com/GalaxyEham/FrostyToolSuite/wiki]Frosty Editor and Mod Manager on github[/url], perhaps it might give you additional ideas for your mods. PS: Sorry if these are rabbit holes
@DSS

I've no idea if this might be useful to you or the other person messing with dds files

MipKiller v1.0

Some games require UI textures with no mip-maps. This tool removes them from DDS files.
https://frostytoolsuitedev.gitlab.io/downloads.html

No idea what this is, but it's on the same page

NormalCompleter v1.0

Do you have a normal map with only two channels of data? This tool will compute the third channel (Z) and fill it in!

Also, you might look at the Frosty Editor and Mod Manager on github, perhaps it might give you additional ideas for your mods.

PS: Sorry if these are rabbit holes

Posted 04/19/2019 06:26 PM   
  143 / 143    
Scroll To Top