xtro
New Member
Posts: 6
|
Post by xtro on Oct 16, 2020 15:34:43 GMT
Hello. I want to use this amazing framework in my URP game but the TerrainDx11Markers shader looks all pink in URP. I don't know how to fix or update a shader for URP. What could be the reason for it not work on URP? As you can see in the screenshot, displacement and tessellation work but any kind of pixel shading doesn't work.
|
|
|
Post by khash on Oct 19, 2020 13:56:34 GMT
do you get any errors? it seem like shader error. Please note that you may need to force reload of the shader to get errors back as they are not shown after clear the same way as other code errors.
|
|
xtro
New Member
Posts: 6
|
Post by xtro on Oct 19, 2020 23:49:28 GMT
From other Unity developers, I learned that the lighting and pixel shading system of URP is very different and it's not a trivial task to convert a non-URP shader into URP version. For that reason, I have bought this asset and I'll try to make it work with the hex map system instead of using HoneyHex dx11 shader. assetstore.unity.com/packages/vfx/shaders/lwrp-urp-tessellation-displacement-157851You don't support URP for Honey Hex project. Right? Do you have any plan for supporting URP soon?
|
|
|
Post by gymfrecklelaundry on Nov 19, 2020 16:06:18 GMT
The only reason I'm not using URP is because of Honey Hex Framework. It's too good to substitute one of the other Hex frameworks - I'd much rather skip URP to be honest.
|
|
|
Post by Roman on Jun 10, 2023 12:56:59 GMT
xtro, hey! Are you succeed with assetstore.unity.com/packages/vfx/shaders/lwrp-urp-tessellation-displacement-157851? I am trying to resolve the same issue and have stuck as well(
|
|
xtro
New Member
Posts: 6
|
Post by xtro on Jun 10, 2023 15:09:41 GMT
Good news for you... yes, I am still using tessellation-displacement shader from asset store but I needed to make some modifications to it. I can't share the full modified shader with you here because I'm not the author of it but I can share my modification instructions. I use these instructions to re-modify it every time the author publishes a new version. You need to use the latest version of the asset. Also, the modification instructions may need to be updated in the future because sometime the changes in the original asset are big ones. The modification instructions file is attached to this post. Also, you may want to see the state of my hex map. These are not the most recent videos but you can get the idea. www.youtube.com/@gamedevelopmentasahobby/videos
|
|
xtro
New Member
Posts: 6
|
Post by xtro on Sept 30, 2023 16:41:16 GMT
A fellow game developer (Stetam) reached me out saying he can't figure out where the HexMap.hlsl in my customization steps come from and I noticed I didn't mention that part earlier. Sorry for that. Here is the additional info. HexMap.hlsl belongs to me so I can share it here. I made that script using an online tool called "shadertoy". Here is the link for the shadertoy version: www.shadertoy.com/view/Nt3cznUnity version has more features like "Fog of War". And here is the Unity version: HexMap.hlsl: #ifndef HEXMAP_INCLUDED
#define HEXMAP_INCLUDED
static const float2 sqr3 = float2(1, 1.7320508); // Y value is the square root of 3.
static const float horizontalHexCount = 6.; // How many hexes we want to place into the full image horizontally.
// https://www.shadertoy.com/view/fdcfWs
float4 getHex(float2 p)
{
p.y = 1. - p.y; // Up is 0 and bottom is 1 because the top-left hex coordinates is (0, 0).
p *= horizontalHexCount;
// After this placement of N number of hexes horizontally, the magic numbers we use below are in integer hex coordinates.
// 1 is 1 hex and .5 is half hex.
p.y -= sqr3.y / 3.; // We shift the vertical index by One Third of Square Root of 3 to make the top tip of the first hex touch the top of the screen.
p.x -= .5; // We shift the horizontal index left by half a hex because we want a full hex on (0, 0) coordinate rather than a half hex.
// vvv This part is from the original shader.
float4 hC = floor(float4(p, p - float2(.5, 1)) / sqr3.xyxy) + .5;
float4 h = float4(p - hC.xy * sqr3, p - (hC.zw + .5) * sqr3);
float4 result = dot(h.xy, h.xy) < dot(h.zw, h.zw)
? float4(h.xy, hC.x - 1., hC.y)
: float4(h.zw, hC.z, hC.w + .5);
// ^^^
result.z += .5; // We revert the left shift we did earlier to get integer indexes like 1, 2, 3 instead of 1.5, 2.5, 3.5.
// I don't know about the math used above but for some reason it returns the vertical hex indexes as half numbers like .5, 1, 1.5, 2 and so on.
// We need to double them to get integer indexes like 1, 2, 3, 4.
result.w *= 2.;
return result;
}
// https://www.shadertoy.com/view/Nt3czn
float getDistanceFromHexCenter(float4 hex)
{
float2 p = abs(hex.xy);
return 2. * max(dot(p, sqr3 * .5), p.x);
}
float sampleFogOfWar(float4 hex)
{
int2 hexCoordinates = hex.zw;
hexCoordinates = int2(hexCoordinates.x + _HexCoordinateOffsetX, hexCoordinates.y + _HexCoordinateOffsetY);
float2 FogOfWarUV = (hexCoordinates + .5) * _FogOfWarMap_TexelSize.xy; // Convert pixel coordinates to UV: https://answers.unity.com/questions/1498163/can-i-sample-a-texture-in-a-fragment-shader-using.html
FogOfWarUV.y = 1 - FogOfWarUV.y;
return SAMPLE_TEXTURE2D_LOD(_FogOfWarMap, sampler_FogOfWarMap, FogOfWarUV, 0).a;
}
#endif //HEXMAP_INCLUDED
|
|
|
Post by stetam on Oct 1, 2023 12:27:14 GMT
A fellow game developer (Stetam) reached me out saying he can't figure out where the HexMap.hlsl in my customization steps come from and I noticed I didn't mention that part earlier. Sorry for that. Here is the additional info. HexMap.hlsl belongs to me so I can share it here. I made that script using an online tool called "shadertoy". Here is the link for the shadertoy version: www.shadertoy.com/view/Nt3cznUnity version has more features like "Fog of War". And here is the Unity version: HexMap.hlsl: Thank you for the clarification. I made all the changes but the shader does not perform elevation, the landscape is totally flat
|
|
xtro
New Member
Posts: 6
|
Post by xtro on Oct 1, 2023 15:24:46 GMT
|
|
|
Post by stetam on Oct 2, 2023 12:23:25 GMT
|
|
|
Post by Toad on Sept 5, 2024 2:13:45 GMT
Just ran into this error myself, but your google link does not work anymore...
also I cant access the Tessellation Displacement Customization Steps.txt (4.88 KB)
|
|
xtro
New Member
Posts: 6
|
Post by xtro on Sept 5, 2024 4:04:51 GMT
Just ran into this error myself, but your google link does not work anymore... also I cant access the Tessellation Displacement Customization Steps.txt (4.88 KB) After you login to this forum, you should be able to see the Tessellation Displacement Customization Steps.txt I uploaded the HexMapChunk prefab to this public file storage. I hope it will be accessible for everyone who needs it for very long time. filebin.net/314r551wrb3wi5kl/HexMapChunk.zip
|
|