Here it is run on openGL with urhosharp bindings to winforms platform and the water is clear.
Any ideas? Is it a transparent vs. black sort of issue or something in the shader?
EDIT:
There is a solution provided at end of this thread. To test that proposed solution, used the 1.7 urho3d version urhosharp distributes and tested on D3D11 win 10 x86 platform, and this did NOT solve the problem, nor provide any visible change. Water still painted black. Not solved.
Also, the render is correct but the blend-states or buffer management are all kinds of messed up. Too many things can make this happen - if an AMD chip though, youāre probably sunk on Win10 in GL.
This is very strange - I suspect the issue is the refractColor term, but the code appears to have the same output for glsl and hlsl. I mean, youāre getting reflections, so itās not the fresnel term, and itās not the reflection term, it has to be about refraction term by pure deduction. Thatās being sourced from an environmental map, so it looks like the problem is narrowed down to a failure on environmental probe to render to (I assume) a cubemap. This is boilerplate code, it should ājust workā. I agree, we need to see the hardware capabilities to figure out whatās going wrong.
Also, I kind of like it - the water looks murky, it has more character than the āworkingā version.
Itās absolutely not correct, but it looks nice
At first I thought this was just hololens, but now have concluded it is D3D11 and the hlsl shaders. Something is not correct here, and itās affecting numerous HLSL shaders.
So here in this thread, I point out Water, Shadows, Outline ⦠all working INCORRECTLY on D3D11 platforms.
For other platform:
Processor Intel(R) Core⢠i7-4770S CPU @ 3.10GHz, 3101 Mhz, 4 Core(s), 8 Logical Processor(s)
Adapter Description Intel(R) HD Graphics 4600
Not sure what other info is useful. Let me know and Iāll get it.
Best for me would be advice on how to troubleshoot further. This issue is readily repeatable for me ⦠just donāt know what to look for next ⦠???
Also, I could not get a NoTextureMultiply to work. The blend state always errors with this error:
System.Exception: Failed to create blend state (HRESULT 80070057).
The Decode: E_INVALIDARG : One or more arguments are not valid ( 0x80070057 )
I saw this error on another issue, where the second UV map was missing. @lezak pointed out the underlying issue, the text of the message was different though, and it pointed out missing vertex elements, but this one doesnāt have that just the blend state failure.
The result is shown, the NoTextureMultiply on UWP:
I suspect there is something going on that is common amongst all these D3D11 shaders, such as blend state. But I have too little experience to know where to look next.
I thought that too, and perhaps it is. But the sample setup uses a reflection camera and a reflection plane, and there is nowhere an environmental map is specified looking through the material, technique and shader files. Also, if I mix a couple of the samples, for instance mix the animating scene with the water sample, the floating cubes from the animating scene are visible in the reflection, so conclude an environmental map isnāt used.
No ⦠Iām wrong. Actually environment is used as described by this comment. This also explains another reason porting the water sample to a stereo application has been so hard. As per the sample code, Iāve only been creating a single refraction camera, but suspect I need two, and they must be working in stereo mode, so the refract pass might (hopefully) get it correct.
When viewed without the nice reflection, for instance, move up and over the water, it just turns black and loses itās ācharacterā. On hololens, this is even more apparent. Though, using a BlueTransparent material looks sort of nice, but there is no rippling of the water.
The overall goal here is to replicate the c++ functionality on hololens using urhosharp. And replicate it perfectly. This is one of the samples that Iāve failed on thus far.
Iām unable to reproduce Your issuses on ānormalā (c++) version of the engine (running on dx11, win10), so Iāve downloaded urhosharp samples and I can see them when running on UWP, so the problem is on the urhosharpās side.
As Iāve gone down this craggy road of shader exploration, mostly Iāve found what is delivered with urhosharp is identical. In some cases they are different, but also renamed in those cases.
I purposely copied or reviewed differences, between water.xml material, water.xml technique and water.hlsl. There is a single difference found, on the water.xml material file, where the water feature sample has changed one parameter used for the water feature sample called basic techniques where a custom material has been defined. But currently the same on urho3d and urhosharp sites.
Doing this is when I found that whatever is in CoreData.pak is always chosen when there. So when I edited various hlsl files I had, those were always ignored in favor of choosing the unedited original in CoreData.pak. I had to rename techniques and shaders to get them to be loaded.
In a loosely related issue, I found a missing hlsl custom shader, and rewrote it from glsl and had fairly good success, but my rewrite wasnāt quite correct, it seemed to change when moving camera from left to right in a stereo application. Eventually I found there was a D3D11 conversion from glsl that Iād missed.A pattern for it shown in the water.hlsl shader. The cbuffer pattern specifically. I put this into the custom shader rewrite and it fixed it. This particular pattern is briefly mentioned, but not in a useful way for this on microsoftās page about hlsl conversion from glsl.
@I3DB Are you using the latest version or 1.7 release. I submitted a bug report sometime ago (#2232) that was creating a similar issue. I think it is fixed on the head.
The file that Iām using has the changes in that commit. If youāre saying these introduced changes caused the issue, then itās not been fixed.
Iām using urhosharp, but will revert that change and see what happens.
Edit:
This thread has been locked, but can still edit the prior posts. The issue is not solved by this change. It does seem like itās the spot on issue, but perhaps the Urhosharp guys did some other changes. Continuing to test this, but so far have found it has no effect by reversing the changes in the commit highlighted in the #2232 closed case.
Edit Next:
The reason it has no effect is because on the testing Iāve done so far, the multisample test, or the need for multisample processing, isnāt set in the code Iām executing. Havenāt tracked down the reason why. That bug was opened for the case where multisample > 1, and apparently it failed and treated multisample as false resulting in water being painted black. In my case, it is false and doesnāt incur the failure, but the end result is the same.
However, this bug case gets right to a spot which can be used to track back the issue.
Edit Final:
Havenāt solved the issue at all.
The bug referenced by @cosar is for a specific case that isnāt happening on the platforms Iām testing.
Additionally, the urho 1.7 branch Iām using has additional code related to the urhosharp implementation of UWP and Hololens. For example compare this urhosharp urho3d file, with the urho3d C++ file, and search on UWP to see some of the changes, or note they differ by over 100 lines. But @lezak is correct in that itās an urhosharp problem.
I did back out the changes as per the bug fix, but it has zero effect on the cases Iām looking at, running on both an x64 and an x86 win10 UWP platforms and one is a hololens. Both behave identically meaning both paint water black in this case and neither produces shadows.
Since this issue is closed here, Iāll try to keep it updated on xamarin once solved.