Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Might be possible to see what happens in luashaders through print() or anything similar? — Gideros Forum

Might be possible to see what happens in luashaders through print() or anything similar?

I wanted to try some shader effect, and even if I understood something by tinkering with already working shaders, I still don't get how to do some pretty basic stuff:

Since I managed to color moving relative portions of the screen at my pleasure, I was trying to draw a more "detailed" thing like a grid.
And here I noticed how much I miss having a print function to see what happens there:

My idea was that I could basically draw a black pixel when its x or y coordinate was even, but it seems that my condition is never triggered, and I guess that the issue is that fTexCoord.x and .y are relative values that go from 0 to 1, not "real" pixel coordinates.. but at the same time I think that I should have got at least a weird output instead of the source image.. :smiley:

Any suggestions?

Effect.grid=makeEffect("grid",
	function (vVertex,vColor,vTexCoord) : Shader
		local vertex = hF4(vVertex,0.0,1.0)
		fTexCoord=vTexCoord
		return vMatrix*vertex
	end,
	function () : Shader
	 local frag=lF4(fColor)*texture2D(fTexture, fTexCoord)
 
	 if fTexCoord.x%2.0 ==0 or fTexCoord.y%2.0 == 0  then  --when x/2 is even
		frag.rgb=lF3(0.0,0.0,0.0) --this changes the pixel color
	 else
		frag.rgb=lF3(frag.r,frag.g,frag.b) --this leaves the original pixel color
	 end
	 if (frag.a==0.0) then discard() end --discard transparent pixels
	 return frag
	end)



thank you!
Tagged:

Comments

Sign In or Register to comment.