Textured Polygons for All!
Re: Textured Polygons for All!
Ugh probably what i need but all i get are errors when i try to run anything from here, also i have no clue how to use shaders and that stuff... this is first example of something finished i found for use besides base shaders used in love/game maker. can any1 send working love2d file with this as extension or what the heck it is so i have something working to examine and learn from? im so stuck with *no step-by-step explanations* that i think i may stick to base game maker 3d and abandon all the cores and optimalization of code for faster performance love2d can give me.
-
- Party member
- Posts: 134
- Joined: Tue Mar 29, 2011 11:05 pm
Re: Textured Polygons for All!
Thought this was cool, well done!
I converted the v8 copy to work with love 0.10.2 so I could test it out, I didn't see a copy anywhere.
I attached it here, hope you don't mind.
I converted the v8 copy to work with love 0.10.2 so I could test it out, I didn't see a copy anywhere.
I attached it here, hope you don't mind.
- Attachments
-
- Demo v8 x1.love
- (206.73 KiB) Downloaded 689 times
Re: Textured Polygons for All!
thanks very much. working and appreciated.
Btw is it free to include in project for commercial purposes, with perspective file intact?
Btw is it free to include in project for commercial purposes, with perspective file intact?
-
- Party member
- Posts: 134
- Joined: Tue Mar 29, 2011 11:05 pm
Re: Textured Polygons for All!
I've sent a PM to xXxMoNkEyMaNxXx to ask if there is a license available, but it looks like his account has not been active for ~2 years.
As for the few changes I made to his code I just spent 20 minutes and expect no credit for it at all.
Re: Textured Polygons for All!
to be secure, do you thin its vise to delete all traces of file being from here/you or can i keep as it is for credits?
last thing i want is get sued, and from own experience i know even own family can do so after 10 years of not being in contact, willing to destroy you whole life for just few bucks.
last thing i want is get sued, and from own experience i know even own family can do so after 10 years of not being in contact, willing to destroy you whole life for just few bucks.
Re: Textured Polygons for All!
I highly doubt you'd get sued, the forum post itself strongly suggests that the user wants you to use their project. You can credit the user (because it's a nice thing to do).
Besides, it's been 4 years since this project and the user has been inactive for 2. It's very probable the user has forgotten about it entirely, and It's very improbable they will stumble upon your project and disassemble it.After hours of thinking and math, here's what everyone's been waiting for!
...
I'm so excited to see what people will make with this!
...
Also, please tell me what I should do so you can be comfortable using it straight out of the box.
Re: Textured Polygons for All!
ugh i fiddled around, and it works perfectly. only problem i encountered and which is bugging me is how much CPU it eats. When designing a game using this shader, i got to point where i was able to display few thousands of walls using this shader, but when i disabled it and made only the math needed to get all the coordinates and everything around, i got up to hundreds of thousands. That means, triggering a draw using this shader is eating up too much of CPU. Is there a way to input a table of objects in single shader call? like make shader loop through pre-sorted table and draw all walls in order, while triggering shader once, instead lets say 4 times for a pillar without top and bottom quads? Is it going to relieve some stress from CPU or not? I am not even at such level to be able to make any for loops work in shader language and i am not sure what is done by cpu and which by gpu...
also id like to know if its possible to modify the shader math so that textures follow up properly when 2 different slopes touch each other. not sure, but i think it may need to supply x,y,z coordinates for all points to work properly, as non-sloped walls works correctly. (sloped in Z coordinate in fake 2d3d)
also id like to know if its possible to modify the shader math so that textures follow up properly when 2 different slopes touch each other. not sure, but i think it may need to supply x,y,z coordinates for all points to work properly, as non-sloped walls works correctly. (sloped in Z coordinate in fake 2d3d)
Last edited by ghurk on Sat Jul 08, 2017 4:06 am, edited 1 time in total.
Re: Textured Polygons for All!
also, id like to know if the 3 lines in shader local
gl_send = glsl.send
local q = love.graphics.polygon
local setShader = love.graphics.setShader
have any value over typing what they contain directly.
then, id like to know if the whole thing being a module has any advantage or not (i did few modifications such as removing possible settings etc. to prevent unnecessar if processes at least, and now im striving for best optimization possible).
**this is all that remains
*reason for p0 and rep being included and sent each time is that i will be using mostly partial cuts from textures, so id need to do so anyway. everything else is currently garbage.
also i noticed that "fast" function is not just a bit faster, but if shader is called thousands of times in single batch on stress test, it could decrease cpu usage even by 20% or so.
i also further modified the shader itself after testing. now i also supply "col" in format {0,0,0,0} to {1,1,1,1} and changed last line of shader to: ("color" is completely deleted)
which allows me to manipulate colors and alpha of texture color instead of transparent parts ( if i dont want it transparent i wont make it so, but when i want to do overlay like glowing part with controlled color based on team color i need this function, also things like partially transparent texture darkening based fake global light and wall angle while keeping transparent parts untouched would be otherwise impossible)
gl_send = glsl.send
local q = love.graphics.polygon
local setShader = love.graphics.setShader
have any value over typing what they contain directly.
then, id like to know if the whole thing being a module has any advantage or not (i did few modifications such as removing possible settings etc. to prevent unnecessar if processes at least, and now im striving for best optimization possible).
**this is all that remains
Code: Select all
local gl_send = glsl.send
local q = love.graphics.polygon
local setShader = love.graphics.setShader
module(...)
function quad(img,v1,v2,v3,v4,p0,rep,col)
gl_send( glsl,"img",img )
gl_send( glsl,"v1",v2 )
gl_send( glsl,"v2",v3 )
gl_send( glsl,"v3",v4 )
gl_send( glsl,"v4",v1 )
gl_send( glsl,"p0",p0 )
gl_send( glsl,"rep",rep )
gl_send( glsl,"col",col )
q( "fill",v1[1],v1[2],v2[1],v2[2],v3[1],v3[2],v4[1],v4[2] )
end
function on()
setShader( glsl )
end
function off()
setShader()
end
also i noticed that "fast" function is not just a bit faster, but if shader is called thousands of times in single batch on stress test, it could decrease cpu usage even by 20% or so.
i also further modified the shader itself after testing. now i also supply "col" in format {0,0,0,0} to {1,1,1,1} and changed last line of shader to:
Code: Select all
return Texel(img,mod(uv*rep+vec2(p0.x-1,p0.y),one))*col;
which allows me to manipulate colors and alpha of texture color instead of transparent parts ( if i dont want it transparent i wont make it so, but when i want to do overlay like glowing part with controlled color based on team color i need this function, also things like partially transparent texture darkening based fake global light and wall angle while keeping transparent parts untouched would be otherwise impossible)
Last edited by ghurk on Sat Jul 08, 2017 4:00 am, edited 2 times in total.
Re: Textured Polygons for All!
i can think of 2 possible scenarios. 1st: compile the mesh "q" + compile all textures in shader (in order, results of new textures will create a layer on top of previous ones and overwrite pixel data) and then draw batch as one mesh with one texture. 2nd: output multiple modified textures data as ive seen it is possible, then use them for multiple meshes, each created for one quad. for future research, id at least like to know which approach seems to perform better. my opinion is 1 mesh+1 texture, but who knows.
Re: Textured Polygons for All!
Please stop double posting. You can edit your posts if you want to add stuff.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Who is online
Users browsing this forum: No registered users and 3 guests