|
Re: Shade-C v0.91 BETA S1 RELEASED
[Re: lostzac]
#407727
09/18/12 15:19
09/18/12 15:19
|
Joined: May 2008
Posts: 2,113 NRW/Germany
alibaba
Expert
|
Expert
Joined: May 2008
Posts: 2,113
NRW/Germany
|
One more thing for your ToDo List After publishing i get an error: "error:88760b59" What does that mean?
|
|
|
Re: Shade-C v0.91 BETA S1 RELEASED
[Re: Rei_Ayanami]
#407806
09/19/12 15:17
09/19/12 15:17
|
Joined: Jun 2004
Posts: 655 to your left
BoH_Havoc
OP
User
|
OP
User
Joined: Jun 2004
Posts: 655
to your left
|
New Update: https://github.com/BoHHavoc/ShadeC-EVO - Moved all code of the Objectshader to default.fx - Added Hooks to Objectshader to easily create/change/add functions, thus being able to create new shaders which derive from the base Objectshader - Fixed "_destroy" crashes - Fixed Gamma Correction - Fixed SSAO Resolution Change - Added Example 05
After publishing i get an error: "error:88760b59" What does that mean? This might be the default.fx or d3dcompiler_42.dll missing...try the new Update, i changed some things so this shouldn't happen again. Please let me know if it works. Because it does exactly what it should do, which was bad in my case creating and sys_freeing something every frame is slow (at least it is for me). ptr_remove seems like a better way of doing it, as in that case the memory is only marked as free, but not really free, so other objects can now write into that memory areas and just overwrite the old data (at least i think that's the way it works). If anyone has more info on this, please go ahead and let us know While further searching for info about this, i stumbled upon the safe_remove macro which i will use in the future. I always forget to manually set object = NULL after using ptr_remove. safe_remove does that job. [edit] Here's some examples of what you can do when deriving from Shade-C's objectshader. Note how both objects cast correct shadows, although their shape is modified by a shader. Both examples are also included in the latest update. Dissolve effect
//------------------------------------------------------------------------------
//----- USER INPUT -------------------------------------------------------------
//------------------------------------------------------------------------------
//assign skins
#define SKIN_ALBEDO (skin1.xyz) //diffusemap
#define SKIN_NORMAL (skin2.xyz) //normalmap
#define SKIN_GLOSS (skin2.w) //glossmap
//...
#define NORMALMAPPING //do normalmapping?
#define GLOSSMAP //entity has glossmap?
//------------------------------------------------------------------------------
// ! END OF USER INPUT !
//------------------------------------------------------------------------------
#include <scHeaderObject>
#define CUSTOM_PS_EXTEND
#ifndef VECSKILL1
#define VECSKILL1
float4 vecSkill1;
#endif
psOut Custom_PS_Extend(vsOut InPs, psOut OutPs)
{
//fetch output color and calculate clip value from it
half clipValue = (dot(OutPs.AlbedoAndEmissiveMask.xyz,1)*vecSkill1.x)-1;
//apply clipping
clip(clipValue);
//output clipvalue to emissive buffer for some nice glow one edges where clipping will occur in the near future
OutPs.AlbedoAndEmissiveMask.w = (1-saturate(clipValue))*0.05;
//set emissive color
OutPs.AlbedoAndEmissiveMask.xyz = lerp(OutPs.AlbedoAndEmissiveMask.xyz, vecSkill1.yzw, pow(1-saturate(clipValue),2));
return OutPs;
}
#include <scObject>
wobbly bloomy thingy (vertices are moved around and object is put into the emissive buffer)
//------------------------------------------------------------------------------
//----- USER INPUT -------------------------------------------------------------
//------------------------------------------------------------------------------
//assign skins
#define SKIN_ALBEDO (skin1.xyz) //diffusemap
#define SKIN_NORMAL (skin2.xyz) //normalmap
#define SKIN_GLOSS (skin2.w) //glossmap
//...
#define NORMALMAPPING //do normalmapping?
#define GLOSSMAP //entity has glossmap?
#define GLOSSSTRENGTH 0 //glossmap channel will be set to this value if GLOSSMAP is not defined
//------------------------------------------------------------------------------
// ! END OF USER INPUT !
//------------------------------------------------------------------------------
#include <scHeaderObject>
#define CUSTOM_VS_POSITION
#ifndef MATWORLD
#define MATWORLD
float4x4 matWorld;
#endif
#ifndef MATWORLDVIEWPROJ
#define MATWORLDVIEWPROJ
float4x4 matWorldViewProj;
#endif
#ifndef VECTIME
#define VECTIME
float4 vecTime;
#endif
#ifndef VECSKILL1
#define VECSKILL1
float4 vecSkill1;
#endif
float4 Custom_VS_Position(vsIn In)
{
float3 P = mul(In.Pos, matWorld);
float force_x = vecSkill1.x;
float force_y = vecSkill1.y;
float speed = sin((vecTime.w+0.2*(P.x+P.y+P.z)) * vecSkill1.z);
if (In.Pos.y > 0 ) // move only upper part of tree
{
In.Pos.x += speed * force_x * In.Pos.y;
In.Pos.z += speed * force_y * In.Pos.y;
In.Pos.y -= 0.1*abs(speed*(force_x+force_y)) * In.Pos.y;
}
return mul(In.Pos,matWorldViewProj);
}
#define CUSTOM_PS_EMISSIVEMASK
float Custom_PS_EmissiveMask(vsOut In, float emissive)
{
return vecSkill1.w;
}
#include <scObject>
|
|
|
Re: Shade-C v0.91 BETA S1 RELEASED
[Re: BoH_Havoc]
#407811
09/19/12 15:51
09/19/12 15:51
|
Joined: May 2008
Posts: 2,113 NRW/Germany
alibaba
Expert
|
Expert
Joined: May 2008
Posts: 2,113
NRW/Germany
|
Awesome! I´ll try it as soon as possible! Btw, Slender is being redone, more professionally by the guy and a team now. Just FYI Hmm bad However, i´m still gonna finish this, just to test the capabilities of Shade-C
|
|
|
Re: Shade-C v0.91 BETA S1 RELEASED
[Re: alibaba]
#407896
09/20/12 15:16
09/20/12 15:16
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
I will implement my bloom (and maybe some other) shaders to Shade-C this weekend if I'll have enough time.
But I've got 2 questions: Does Shade-C already support adaption and does it support higher color-ranges than RGBA 0-255 (HDRR)
POTATO-MAN saves the day! - Random
|
|
|
Re: Shade-C v0.91 BETA S1 RELEASED
[Re: Kartoffel]
#407952
09/21/12 21:10
09/21/12 21:10
|
Joined: Jun 2004
Posts: 655 to your left
BoH_Havoc
OP
User
|
OP
User
Joined: Jun 2004
Posts: 655
to your left
|
Still getting that error I'll have a look at it again then Does Shade-C already support adaption and does it support higher color-ranges than RGBA 0-255 (HDRR) adaption is not supported at the moment. You'll have to do the luminance map downsampling yourself. Lighting supports MDR-HDR values (medium to high range). To Unpack Lighting, #include <scUnpackLighting> and use float4 UnpackLighting(float4 input) to unpack. Lighting is stored in sc_screen_default.renderTargets.deferredLighting . Everything else is non-HDR. However you can encode RGB to Log LUV to get a higher range. The functions for that are already implemented. To use, simply #include <scRGBtoLogLUV> or #include <scLogLUVtoRGB>. You can then use the functions float4 RGBtoLogLUV(float3 input) and float3 LogLUVtoRGB(float4 input). The current pipeline is: gBuffer->lighting->ssao->final composition using lighting,color,ssao,etc->antialiasing->forward rendering->refractions->DOF->Bloom/HDR So i guess you'd have to encode the "final composition" part to LogLUV and decode in Bloom/HDR Please let me know if you need something for your HDRR implementation and i'll try to implement it as soon as possible. [edit] Please get the latest version, there was a small bug with LogLuv encoding. -> https://github.com/BoHHavoc/ShadeC-EVO
Last edited by BoH_Havoc; 09/22/12 12:37.
|
|
|
Re: Shade-C v0.91 BETA S1 RELEASED
[Re: BoH_Havoc]
#408021
09/23/12 21:08
09/23/12 21:08
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
I had some problems when adding new shaders and changing the order of the hdr render-chain... ( I tried to add another bloom layer which uses the first bloom as source image for a second, high-radius bloom blur but with leaving the first bloom as source image for the lensflare ) ...looks like this was a bit too much for the beginning However, I think and I hope that I finally understand it now I started again from zero and I haven't had any problems this time. At the moment I keep the bloom and lensflare images seperate to use alpha-blending for the bloom and add-blending for the lensflares with a setting to prevent overexposure. For this I split sc_hdr.fx into sc_hdr_BloomAndLens.fx and sc_hdr_BloomOnly.fx. Here is a screenshot which shows the new bloom effect pretty good.I also added the integer settings.hdr.quality to change the downsampling and bloom quality with SC_LOW: downsampling with 1 sample per pixel, 1 bloom-stage SC_MEDIUM: downsampling with 7 samples per pixel, 1 bloom-stage SC_HIGH: downsampling with 11 samples per pixel, 2 bloom-stages SC_ULTRA: downsampling with 13 samples per pixel, 2 bloom-stages Higher quality downsampling will prevent aliasing and makes it possible to use more downsampling and results in smoother blurring. the bloom quality isn't affected by it, yet but this will be the next thing I'll add I think I'll also add a video-grain effect, and if it's not too hard an adaption shader.
Last edited by Kartoffel; 09/23/12 21:26.
POTATO-MAN saves the day! - Random
|
|
|
|