Difference between revisions of "SourceShaderEditor/Installation"

From Valve Developer Community
Jump to: navigation, search
m
m (new version 0.1.1)
Line 5: Line 5:
  
 
{{Warning|Currently only the Source 2007 SDK is supported}}
 
{{Warning|Currently only the Source 2007 SDK is supported}}
 +
 +
 +
== Changelog latest version ( 0.1.1 ) ==
 +
Bugfixes:
 +
* Framebuffer copy texture 0 staying undefined
 +
* Potential stability issue for fast material reload
 +
* Material picker errors in singleplayer mods
 +
  
 
== Implementation files ==
 
== Implementation files ==
 
=== Download ===
 
=== Download ===
* (7z) Download version 0.1 at [http://bio2k.homepage.t-online.de/shadereditor/v0_1/SSE_implementation_v0.1.7z]
+
* (7z) Download version 0.1.1 at [http://bio2k.homepage.t-online.de/shadereditor/v0_1_1/SSE_implementation_v0.1.1.7z]
* (zip) Download version 0.1 at [http://bio2k.homepage.t-online.de/shadereditor/v0_1/SSE_implementation_v0.1.zip]
+
* (zip) Download version 0.1.1 at [http://bio2k.homepage.t-online.de/shadereditor/v0_1_1/SSE_implementation_v0.1.1.zip]
  
 
=== Installation ===
 
=== Installation ===
Line 82: Line 90:
  
 
=== Download ===
 
=== Download ===
* (7z) Download version 0.1 at [http://bio2k.homepage.t-online.de/shadereditor/v0_1/SSE_standalone_v0.1.7z]
+
* (7z) Download version 0.1.1 at [http://bio2k.homepage.t-online.de/shadereditor/v0_1_1/SSE_standalone_v0.1.1.7z]
* (zip) Download version 0.1 at [http://bio2k.homepage.t-online.de/shadereditor/v0_1/SSE_standalone_v0.1.zip]
+
* (zip) Download version 0.1.1 at [http://bio2k.homepage.t-online.de/shadereditor/v0_1_1/SSE_standalone_v0.1.1.zip]
  
 
=== Installation ===
 
=== Installation ===

Revision as of 18:40, 19 July 2011

This article will describe how to install the editor libraries into your own mod. You will be required to compile the client library at the end, so make sure that you can compile the source code from the SDK successfully.

Warning: Currently only the Source 2007 SDK is supported


Changelog latest version ( 0.1.1 )

Bugfixes:

  • Framebuffer copy texture 0 staying undefined
  • Potential stability issue for fast material reload
  • Material picker errors in singleplayer mods


Implementation files

Download

  • (7z) Download version 0.1.1 at [1]
  • (zip) Download version 0.1.1 at [2]

Installation

  • Copy the contents of source_shader_editor/mod to the directory of your own mod (Steam/steamapps/SourceMods/MY_MOD). Among these files are the libraries that contain the editor and shader implementation, content resources and script files. The folder ../mod/shadereditorui will contain all content generated by the editor; for example your canvases can be located in ../mod/shadereditorui/canvas and temporary plus final HLSL source files will be stored in ../shadereditorui/shader_src.
  • Copy the folder source_shader_editor/code/ShaderEditor and its contents to the codebase of your mod into ../src/game/client/. If you want to change the directory, make sure that you adjust the #includes in all files accordingly!

Compile

  • Open Visual Studio and load your mods solution.
    • (optional) Add a new filter in the Source Files folder of your client project.
  • Add all implementation files (and headers) from ../src/game/client/ShaderEditor to your new filter or elsewhere into your client project.
  • Open viewrender.cpp and add the include #include "ShaderEditor/ShaderEditorSystem.h" at the top, right above #include "tier0/memdbgon.h".
  • In viewrender.cpp go to the function void CViewRender::RenderView(...) and add the two lines highlighted in the following block:
		// Now actually draw the viewmodel
		DrawViewModels( view, whatToDraw & RENDERVIEW_DRAWVIEWMODEL );

		g_ShaderEditorSystem->UpdateSkymask();

		DrawUnderwaterOverlay();

		PixelVisibility_EndScene();

		// Draw fade over entire screen if needed
		byte color[4];
		bool blend;
		vieweffects->GetFadeParams( &color[0], &color[1], &color[2], &color[3], &blend );

		// Draw an overlay to make it even harder to see inside smoke particle systems.
		DrawSmokeFogOverlay();

		// Overlay screen fade on entire screen
		IMaterial* pMaterial = blend ? m_ModulateSingleColor : m_TranslucentSingleColor;
		render->ViewDrawFade( color, pMaterial );
		PerformScreenOverlay( view.x, view.y, view.width, view.height );

		// Prevent sound stutter if going slow
		engine->Sound_ExtraUpdate();	
	
		if ( !building_cubemaps.GetBool() && view.m_bDoBloomAndToneMapping )
		{
			pRenderContext.GetFrom( materials );
			{
				PIXEVENT( pRenderContext, "DoEnginePostProcessing" );

				bool bFlashlightIsOn = false;
				C_BasePlayer *pLocal = C_BasePlayer::GetLocalPlayer();
				if ( pLocal )
				{
					bFlashlightIsOn = pLocal->IsEffectActive( EF_DIMLIGHT );
				}
				DoEnginePostProcessing( view.x, view.y, view.width, view.height, bFlashlightIsOn );
			}
			pRenderContext.SafeRelease();
		}

		g_ShaderEditorSystem->CustomPostRender();

		// And here are the screen-space effects

		if ( IsPC() )
		{
			// Grab the pre-color corrected frame for editing purposes
			engine->GrabPreColorCorrectedFrame( view.x, view.y, view.width, view.height );
		}
  • Compile the solution.
  • To enable the shader editor add -shaderedit to your command line.


Stand-alone demo

Download a precompiled mod based on the Source 2007 SDK.

Download

  • (7z) Download version 0.1.1 at [3]
  • (zip) Download version 0.1.1 at [4]

Installation

Copy the mod folder into Steam/steamapps/SourceMods/ as usual. The editor should show on startup without further ado. The demo won't allow you to immediately use the shaders elsewhere, however you can still take the HLSL source files and implement them manually in your own shader library.