Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, Aku_Aku, 1 invisible), 579 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
textureLod into HLSL #479450
03/30/20 18:01
03/30/20 18:01
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Hey,

I've been trying to convert some stuff from shadertoy into HLSL and faced this textureLod thing:
Code
vec3 col = textureLod(iChannel0, UV+n, focus).rgb;
Here how I tried to solve it:
Code
float4 s = float4(UV.x + n.x, UV.y + n.y, 0, focus);
float3 col = tex2Dlod(postTex, s).rgb;
This one does compile, but it doesn't seems to work correctly (doesn't get blurred)...
[Linked Image]

Then I tried this:
Code
Texture2D MyTexture;


float4 FP(float2 fragCoord: VPOS) : COLOR
{
	/// ... ///
	
	float3 col = MyTexture.SampleLevel(postTex, UV+n, focus).rgb;
	
	/// ... ///
}
But it gave me malfunction W1550:
[Linked Image]

Here is original version:
https://www.shadertoy.com/view/ltffzl

Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: textureLod into HLSL [Re: 3run] #479459
03/31/20 07:04
03/31/20 07:04
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Code
Texture2D MyTexture;


float4 FP(float2 fragCoord: VPOS) : COLOR
{
	/// ... ///
	
	float3 col = MyTexture.SampleLevel(postTex, UV+n, focus).rgb;
	
	/// ... ///
}


i think "SampleLevel" is part of shader 4.0. (Minimum dx10)


Re: textureLod into HLSL [Re: Emre] #479460
03/31/20 09:28
03/31/20 09:28
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted by Emre
i think "SampleLevel" is part of shader 4.0. (Minimum dx10)
That's sad... so I guess there is no easy way to convert this line?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: textureLod into HLSL [Re: 3run] #479461
03/31/20 09:36
03/31/20 09:36
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Originally Posted by 3run
Code
float4 s = float4(UV.x + n.x, UV.y + n.y, 0, focus);
float3 col = tex2Dlod(postTex, s).rgb;

This one does compile, but it doesn't seems to work correctly (doesn't get blurred)...


You are right there, 'tex2Dlod' is the corresponding function but the source image needs mipmaps to make a difference. It seems you are trying to blur a scene through its render target and render targets never have mipmaps.

Re: textureLod into HLSL [Re: 3run] #479462
03/31/20 10:21
03/31/20 10:21
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Oh, I was using it in a wrong way then! Thank you for making things clear! laugh


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1