[QUOTE=Mr_Roberto;18538414]Once the documentation's up, I think we'll see a lot more renderX functions being used in the future![/QUOTE]
Indeed, but for that to happen said documentation needs to be filled up with and have examples from someone who know what they're doing. And that someone isn't me. :buddy:
So it would be nice if those who have experience using these functions/developed them could take some time to write a page or two. :smile:
[QUOTE=Mr_Roberto;18538414]I'm liking this stencil buffer:
[IMG_THUMB]http://i48.tinypic.com/2yn41w4.jpg[/IMG_THUMB]
I'm confused about some things though...
1. Does STENCILOPERATION_REPLACE replace the pixels with the reference value?
2. What do the write masks and test masks do exactly?
3. When is the fail operation called?
4. What does render.PerformFullScreenStencilOperation do?
5. Is there any way to create and draw to additional stencil buffers?
Once the documentation's up, I think we'll see a lot more renderX functions being used in the future![/QUOTE]
1. It replaces the value in the stencil buffer with whatever reference value you used.
2. A bitwise and is performed on both values. You can selectively write to the buffer.
3. When the test fails of course.
4. No idea, I'll research it.
5. The stencil write and test mask. It'll allow you to divide the 8 bits of the stencil buffer up among various things.
[QUOTE=Jinto;18535481][img_thumb]http://cdbarrett.com/dm_overwatch0000.jpg[/img_thumb][/QUOTE]
I can't seem to get this to work, either with bloom textures or render targets. I'm using a bot to test it with, but it just doesn't render the effect. Doesn't error or anything. I'm running it clientside with lua_openscript_cl.
I have a debug-print in the end of the RenderToGlowTexture-function, and it seems to get called properly.
The code is unmodified, and this is what I have in the RT-files:
settings\render_targets\L4D1.txt
[code]"L4D1"
{
"Name" "L4D1"
"Width" "512"
"Height" "512"
}[/code]
settings\render_targets\L4D2.txt
[code]"L4D2"
{
"Name" "L4D2"
"Width" "512"
"Height" "512"
}[/code]
Is there anything that I did wrong, or is it just my computer? Thanks in advance.
[media]http://stoned.bplaced.net/img/lua/deathrun_iceworld_v20000.jpg[/media]
Works fine for me (with same settings, L4D1/2...)
Here's my debug if it does any good.
[code]- PostPlayerDraw called
-- RenderToStencil called for Player [2][Bot03]
-- RenderToGlowTexture called for Player [2][Bot03]
- PostPlayerDraw reached end
- Compositing glow at RenderScreenspaceEffects on CompositeGlow-hook
- Resetting glow at RenderScene on ResetGlow-hook
...[/code]
Should the glow get reset right after it has been composited?
[QUOTE=DarKSunrise;18547579]Here's my debug if it does any good.
[code]- PostPlayerDraw called
-- RenderToStencil called for Player [2][Bot03]
-- RenderToGlowTexture called for Player [2][Bot03]
- PostPlayerDraw reached end
- Compositing glow at RenderScreenspaceEffects on CompositeGlow-hook
- Resetting glow at RenderScene on ResetGlow-hook
...[/code]
Should the glow get reset right after it has been composited?[/QUOTE]
Yes, it needs to be cleared at the start of every frame. RenderScene is called before anything is drawn.
Set up render targets like DarkSunrise, Doesn't seem to work for me. Basically same code, although with a modification to draw whatever I look at (minus the world).
Does draw, but in the wrong place, and only when I have my flashlight on.
If I look at a barrel, it draws the barrel a bit higher up + in the wrong place with the wrong size, and as if looking from below.
Same with kleiner and one or two other props. (other ones don't draw at all)
Weird.
GetRenderTarget('L4D1'):IsError() returns false.
Any ideas?
Why wasn't SetFogParams included in the update?
I can't get the normal fog functions to work..
[QUOTE=Kill coDer;18573652]Why wasn't SetFogParams included in the update?
I can't get the normal fog functions to work..[/QUOTE]
You need to set sv_cheats to 1 to get the normal fog system to work.
I also noticed that it only draws when I have flashlight on. Tried updating my drivers, but it had no effect.
I'm running ATI Radeon HD 3600 Series if it matters.
[img_thumb]http://filesmelt.com/downloader/gm_construct000427.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct000532.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct000627.jpg[/img_thumb]
[QUOTE=DarKSunrise;18580871]I also noticed that it only draws when I have flashlight on. Tried updating my drivers, but it had no effect.
I'm running ATI Radeon HD 3600 Series if it matters.
[img_thumb]http://filesmelt.com/downloader/gm_construct000427.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct000532.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct000627.jpg[/img_thumb][/QUOTE]
Found a hacky solution to the flashlight problem. Inside PostPlayerDraw add the following.
[lua]if( ScrW() == 512 && ScrH() == 512 ) then
return;
end[/lua]
[editline]07:24AM[/editline]
Apparently render.ClearRenderTarget doesn't clear depth information. So replace that line with this.
[lua]local oldRT = render.GetRenderTarget();
render.SetRenderTarget( RT1 );
render.Clear( 0, 0, 0, 255, true );
render.SetRenderTarget( oldRT );[/lua]
That should fix it not rendering for you guys.
[editline]07:26AM[/editline]
[QUOTE=Kill coDer;18573652]Why wasn't SetFogParams included in the update?
I can't get the normal fog functions to work..[/QUOTE]
I believe I gave the explanation for why they weren't included somewhere. As for the fog functions that were added, that is only for your own rendering, not the whole scene. All the fog parameters are reset when the scene is started. You could try setting them in the PreDrawOpaqueRenderables function, but I doubt that'd work like you'd expect.
Now it renders properly, but I still have the flashlight problem. It appears that it has something to do with the dynamic shadow of the flashlight, as it seems to be somewhat relative to the shadow.
[img_thumb]http://filesmelt.com/downloader/gm_construct000716.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct000822.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct000920.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct001024.jpg[/img_thumb]
[QUOTE=DarKSunrise;18583007]Now it renders properly, but I still have the flashlight problem. It appears that it has something to do with the dynamic shadow of the flashlight, as it seems to be somewhat relative to the shadow.
[img_thumb]http://filesmelt.com/downloader/gm_construct000716.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct000822.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct000920.jpg[/img_thumb] [img_thumb]http://filesmelt.com/downloader/gm_construct001024.jpg[/img_thumb][/QUOTE]
Well, guess the flashlight depth texture is only 512x512 on my system. Try this instead.
[lua]if( ScrW() == ScrH() ) then return; end[/lua]
Thanks, it works almost perfectly now. It still draws some odd lines to the edges of my screen when the entity is clipping from the view.
[img_thumb]http://filesmelt.com/downloader/gm_construct001116.jpg[/img_thumb]
Take a look at the bottom right corner of that image. It's very annoying when it's on motion.
Jinto, why don't you write a little documentation on the functions? Most of the people don't understand them at all and since you made the module, you know how they work.
[QUOTE=Grocel;18578093]You need to set sv_cheats to 1 to get the normal fog system to work.[/QUOTE]
That's crap.
If I use gm_cvar2, maybe I can change that...
Jinto please just include the SetFogParams functions :(
[QUOTE=Dlaor;18583489]Jinto, why don't you write a little documentation on the functions? Most of the people don't understand them at all and since you made the module, you know how they work.[/QUOTE]
The functions names aren't enigmatic. In fact, they're completely self descriptive. Most are direct binds to the functions in the SDK so you can find everything you need to know in there.
Okay, works for me, however, I can't see it with normal player view. It won't show up unless I use the gmod camera or something to view it. Tried it with props, everything, still only works with camera.
I also get those artifacts on the sides of the screen, those coloured lines some guy said about before me.
Any ideas
[b]Edit: It's not rendering at all in first-person; I only get the fps hit whilst using the camera.[/b]
Still confused on how to apply fog. This doesn't work.
[lua]function FogCam()
local CamData = {}
CamData.angles = LocalPlayer():EyeAngles()
CamData.origin = LocalPlayer():GetShootPos()
CamData.x = 0
CamData.y = 0
CamData.w = ScrW()
CamData.h = ScrH()
render.FogStart( 30 )
render.FogEnd( 150 )
render.FogColor( 230, 255, 255 )
render.FogMode( MATERIAL_FOG_LINEAR )
render.RenderView( CamData )
end
hook.Add( "HUDPaint", "FogCam", FogCam )
[/lua]
[QUOTE=Dlaor;18621820]Still confused on how to apply fog. This doesn't work.
[lua]function FogCam()
local CamData = {}
CamData.angles = LocalPlayer():EyeAngles()
CamData.origin = LocalPlayer():GetShootPos()
CamData.x = 0
CamData.y = 0
CamData.w = ScrW()
CamData.h = ScrH()
render.FogStart( 30 )
render.FogEnd( 150 )
render.FogColor( 230, 255, 255 )
render.FogMode( MATERIAL_FOG_LINEAR )
render.RenderView( CamData )
end
hook.Add( "HUDPaint", "FogCam", FogCam )
[/lua][/QUOTE]
"HUDPaint" is mainly where you're going wrong.
[QUOTE=SteveUK;18630073]"HUDPaint" is mainly where you're going wrong.[/QUOTE]
Let's see...
- CalcView, Think didn't do anything
- RenderScreenspaceEffects gave me C stack overflow spam and 0.1 fps
[QUOTE=Dlaor;18639238]Let's see...
- CalcView, Think didn't do anything
- RenderScreenspaceEffects gave me C stack overflow spam and 0.1 fps[/QUOTE]
[lua]
local depth, max_depth = 0, GetConVarNumber("max_render_depth_addon_thingy_whatever")
cvars.AddChangeCallback("max_render_depth_addon_thingy_whatever", function(cv, old, new)
max_depth = tonumber(new) or 10
end)
hook.Add("RenderScreenspaceEffects", "addon_thingy_whatever", function()
if depth > max_depth then return end
depth = depth+1
... code here ...
depth = depth-1
end)
[/lua]
Say I wanted to , when I spawn a sent , only a small green plane can be seen , this rises up and you can see the sent's model being made underneath it.
It's going to take a while to fully understand the commands , but hopefully I'll be able to achieve this.
I'm thinking of a mesh and a clipping plane.
[QUOTE=Deco Da Man;18639348][lua]
local depth, max_depth = 0, GetConVarNumber("max_render_depth_addon_thingy_whatever")
cvars.AddChangeCallback("max_render_depth_addon_thingy_whatever", function(cv, old, new)
max_depth = tonumber(new) or 10
hook.Add("RenderScreenspaceEffects", "addon_thingy_whatever", function()
if depth > max_depth then return end
depth = depth+1
... code here ...
depth = depth-1
end)
[/lua][/QUOTE]
Here's my code now. (by the way, you forgot a last end)
[lua]CreateClientConVar( "max_render_depth_addon_thingy_whatever", 10, false, false )
local depth, max_depth = 0, GetConVarNumber( "max_render_depth_addon_thingy_whatever" )
cvars.AddChangeCallback( "max_render_depth_addon_thingy_whatever", function( cv, old, new )
max_depth = tonumber( new ) or 10
hook.Add( "RenderScreenspaceEffects", "addon_thingy_whatever", function()
if depth > max_depth then return end
depth = depth+1
RenderFog()
depth = depth-1
end)
end)
function RenderFog()
local CamData = {}
CamData.angles = LocalPlayer():EyeAngles()
CamData.origin = LocalPlayer():GetShootPos()
CamData.x = 0
CamData.y = 0
CamData.w = ScrW()
CamData.h = ScrH()
render.FogStart( 30 )
render.FogEnd( 150 )
render.FogColor( 230, 255, 255 )
render.FogMode( MATERIAL_FOG_LINEAR )
render.RenderView( CamData )
PrintTable( CamData )
end[/lua]
Although it does change the view a bit (no recoil, fucked up reflections), there's still the default fog. Why is this so hard?!
The fog bindings don't change scene fog! I've mentioned this in just about every fog function on the wiki.
They are made for your own rendering, etc. The scene fog is reset every time the scene starts (render.RenderView). Your only hope of altering that is doing it in PreDrawOpaqueRenderables, or whatever that new hook was named, and even that won't work like you want.
I didn't want to add the SetFogParams function because it uses networked variables. I didn't look very deep into it, but I didn't want to allow you to modify networked variables clientside. If I look into it further and decide to add it, I'll send it to garry and it may or may not be in the next update.
[QUOTE=Dlaor;18639419]Here's my code now. (by the way, you forgot a last end)
[lua]CreateClientConVar( "max_render_depth_addon_thingy_whatever", 10, false, false )
local depth, max_depth = 0, GetConVarNumber( "max_render_depth_addon_thingy_whatever" )
cvars.AddChangeCallback( "max_render_depth_addon_thingy_whatever", function( cv, old, new )
max_depth = tonumber( new ) or 10
hook.Add( "RenderScreenspaceEffects", "addon_thingy_whatever", function()
if depth > max_depth then return end
depth = depth+1
RenderFog()
depth = depth-1
end)
end)
function RenderFog()
local CamData = {}
CamData.angles = LocalPlayer():EyeAngles()
CamData.origin = LocalPlayer():GetShootPos()
CamData.x = 0
CamData.y = 0
CamData.w = ScrW()
CamData.h = ScrH()
render.FogStart( 30 )
render.FogEnd( 150 )
render.FogColor( 230, 255, 255 )
render.FogMode( MATERIAL_FOG_LINEAR )
render.RenderView( CamData )
PrintTable( CamData )
end[/lua]
Although it does change the view a bit (no recoil, fucked up reflections), there's still the default fog. Why is this so hard?![/QUOTE]
I stuffed up a bit. Fixed. Coding while tired and concentrating on homework = bad.
Hey, been reading up on renderx and was wondering if it's possible to draw a completely orthographic/oblique view using renderx.
I.E. no perspective.
There isn't a lot of documentation for many of the functions so I thought I'd ask in here before I go randomly trying different functions hoping something will work.
[QUOTE=DEADBEEF;18800322]Hey, been reading up on renderx and was wondering if it's possible to draw a completely orthographic/oblique view using renderx.
I.E. no perspective.
There isn't a lot of documentation for many of the functions so I thought I'd ask in here before I go randomly trying different functions hoping something will work.[/QUOTE]
Last update added some extra options to render.RenderView.
[list]
[*]ortho
[*]ortholeft
[*]orthoright
[*]orthotop
[*]orthobottom
[/list]
[QUOTE=Jinto;18814682]Last update added some extra options to render.RenderView.
[list]
[*]ortho
[*]ortholeft
[*]orthoright
[*]orthotop
[*]orthobottom
[/list][/QUOTE]
Oh cool, hadn't noticed those.
Does it say anywhere how to get them working?
And for some reason, when using render.RenderView the main view goes really blurry...
eg... [url]http://i.imgur.com/SLjvV.jpg[/url]
[QUOTE=DEADBEEF;18818109]Oh cool, hadn't noticed those.
Does it say anywhere how to get them working?
And for some reason, when using render.RenderView the main view goes really blurry...
eg... [url]http://i.imgur.com/SLjvV.jpg[/url][/QUOTE]
Try disabling motion blur from video settings.
[B]edit:[/B]
Is it possible to fix this water bug: [url]http://img215.imageshack.us/img215/9100/gmconstruct0057.jpg[/url] ?
Sorry, you need to Log In to post a reply to this thread.