Difference between revisions of "SourceShaderEditor/Installation"

From Valve Developer Community
Jump to: navigation, search
(updated to version 0.3)
m (added download alternatives to crappy host)
Line 101: Line 101:
 
== Implementation files ==
 
== Implementation files ==
 
=== Download ===
 
=== Download ===
* (7z) Download version 0.3 at [http://bio2k.homepage.t-online.de/shadereditor/v0_3/SSE_implementation_v0.3.7z]
+
* (7z) Download version 0.3 at [http://dl.dropbox.com/u/7340612/sse_release/v0_3/SSE_implementation_v0.3.7z dropbox] [http://bio2k.homepage.t-online.de/shadereditor/v0_3/SSE_implementation_v0.3.7z alt]
* (zip) Download version 0.3 at [http://bio2k.homepage.t-online.de/shadereditor/v0_3/SSE_implementation_v0.3.zip]
+
* (zip) Download version 0.3 at [http://www.mediafire.com/download.php?9bqdef9m95g4p6t mediafire] [http://dl.dropbox.com/u/7340612/sse_release/v0_3/SSE_implementation_v0.3.zip dropbox] [http://bio2k.homepage.t-online.de/shadereditor/v0_3/SSE_implementation_v0.3.zip alt]
  
 
=== Installation ===
 
=== Installation ===
Line 202: Line 202:
  
 
=== Download ===
 
=== Download ===
* (7z) Download version 0.3 at [http://bio2k.homepage.t-online.de/shadereditor/v0_3/SSE_standalone_v0.3.7z]
+
* (7z) Download version 0.3 at [http://dl.dropbox.com/u/7340612/sse_release/v0_3/SSE_standalone_v0.3.7z dropbox] [http://bio2k.homepage.t-online.de/shadereditor/v0_3/SSE_standalone_v0.3.7z alt]
* (zip) Download version 0.3 at [http://bio2k.homepage.t-online.de/shadereditor/v0_3/SSE_standalone_v0.3.zip]
+
* (zip) Download version 0.3 at [http://www.mediafire.com/download.php?v3caevyb3p8ju3c mediafire] [http://dl.dropbox.com/u/7340612/sse_release/v0_3/SSE_standalone_v0.3.zip dropbox] [http://bio2k.homepage.t-online.de/shadereditor/v0_3/SSE_standalone_v0.3.zip alt]
  
 
=== Installation ===
 
=== Installation ===

Revision as of 10:32, 28 February 2012

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.

Note:Currently the Source SDK Base 2007 and Alien Swarm mods are supported.
Confirm:Some AMD/ATI hardware seems to show erroneous behaviour when reading negative values from textures. This solely affects the 2D preview on the graph.


Swarm info

The Alien Swarm support is based on a ported 2007 SDK since there is no official shader/materialsystem implementation source for swarm. Therefore you might experience inconsistencies primarily with scene shaders, some known differences are listed here:

  • Applying alpha blended shaders to geometry in the scene which was opaque before may require you to reload the map, the entities might just disappear first.
  • Flashlight projection on world geometry does not work at all.
  • Swarm is capable of supporting custom vertex textures.


Changelog

Version 0.3 Changes:

  • Added support for SWARM SDK
  • Added more primitive types to the 3d preview
  • Added tabs for flow graphs
  • Added some help texts to the general tab in the node properties and a tooltip to the flowgraph
  • Added unique texcoord dim setting for each stage of the vs input semantics
  • Added support for alpha to coverage
  • Added custom grass rendering code with morphing (optional)
  • Added vertex compression support to the fallback shader
  • Added vertex texture sampler implementation (SWARM ONLY)
  • Added dialog to recompile all shaders that were selected for precaching. You will have to recompile old shaders once yourself first though.
  • Added Miscellaneous nodes: group
  • Added HLSL nodes: custom code, vertex decompress
  • Added post processing nodes: RT, Material, Copy RT, Draw Material, clear buffers, update FB copy, Render view, push VP, pop VP, set RT


  • Changed layout and color scheme (old scheme can still be found as ShaderEditorScheme_Old.res)
  • Changed Skinning node to flip the binormal automatically (to compensate the inverted green channel in normalmaps)
  • Changed flowgraph screenshots to use jpeg compression


  • Fixed some memory leaks
  • Fixed packed editor materials to unpack 'insert' keys improperly
  • Fixed custom texcoord dimensions not being applied correctly
  • Fixed mutable vparam node not updating hierachy on datatype change
  • Fixed max amount of pixelshader constants being displayed as 14 instead of 13
  • Fixed vparam static ignoring first occurance of '-' in the vmt string
  • Fixed tangentspace being broken on sphere mesh under certain conditions (will only work while you use the default texcoord input dimensions in the VS Input node!)
  • Fixed flashlight code not binding cookie texture from dynamic flashlight state
  • Fixed post processing shader preview + 2D preview not performing FB copy properly



Version 0.2.1 Changes:

  • Fixed parallax amount being dependent from relative uv/world scale
  • Fixed shaders on prop_static requiring $bumpmap to be defined for lighting
  • Fixed gaussian weights being calculated wrongly in some cases
  • Fixed a crash with morph node


  • Added nodes: clip



Version 0.2 Changes:

  • Added nodes: array, condition, sampler object, flashlight origin, parallax uv, parallax shadow
  • Added undo/redo to file menu, ctrl+z/ ctrl+shift+z
  • Added custom matrices: projection, view projection, view inverse, projection inverse, view projection inverse
  • Added sampler datatype
  • Added ( 4x3 * 4x4 ) for multiply node
  • Added examples: lightmap_parallax, postproc_depthglow, postproc_gaussblur_2d_singlepass (note: really just a POC for previewing!)


  • Fixed datatype of custom matrix - view
  • Fixed hierachy not updating when float3x3 was toggled on the multiply node
  • Fixed lightscale settings of Final output node not being applied correctly
  • Fixed lightmap lookups not automatically enforcing SRGB read in LDR mode


  • VS texture samplers are now identifiable. This may break old shaders using the Morph node, re-compile them.
  • Exposed datatype of texcoords/color for VS input semantics
  • Bridges of input jacks can now be overridden more easily
  • Changed refraction example to use newer float3x3 cast on multiply + user matrix in PS
  • Improved solver algorithm for stacked containers
  • Changed default texture names of fallback textures
  • The precache dialog will now sort all entries by name



Version 0.1.2 Changes:

  • Fixed binary path being cut off
  • Fixed solver crash
  • Added 3dskybox support for the skymask (viewrender.cpp needs to be updated)



Version 0.1.1 Changes:

  • Fixed framebuffer copy texture 0 staying undefined
  • Fixed potential stability issue for fast material reload
  • Fixed material picker errors in singleplayer mods


Implementation files

Download

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! The folder source_shader_editor/code/ShaderEditor/Grass does not have to be copied along, only if you plan on using it. If you're wondering what it looks like, check out the map sdk_vehicles in the demo below. For its specific installation instructions, refer to the readme in the same folder.

Compile

Warning: The Alien Swarm code may look slightly different, but you should be able to find the correct places easily.

  • 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 three lines highlighted at the respective position:
		// if the 3d skybox world is drawn, then don't draw the normal skybox
		CSkyboxView *pSkyView = new CSkyboxView( this );
		if ( ( bDrew3dSkybox = pSkyView->Setup( view, &nClearFlags, &nSkyboxVisible ) ) != false )
		{
			AddViewToScene( pSkyView );
			g_ShaderEditorSystem->UpdateSkymask();
		}
		SafeRelease( pSkyView );

[...]

		// Now actually draw the viewmodel
		DrawViewModels( view, whatToDraw & RENDERVIEW_DRAWVIEWMODEL );

		g_ShaderEditorSystem->UpdateSkymask( bDrew3dSkybox );

		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 );
		}
  • In the same file, go to the function void CViewRender::ViewDrawScene(...) and add the highlight lines at the respective place:
	ParticleMgr()->IncrementFrameCode();

	DrawWorldAndEntities( drawSkybox, view, nClearFlags, pCustomVisibility );

	VisibleFogVolumeInfo_t fogVolumeInfo;
	render->GetVisibleFogVolume( view.origin, &fogVolumeInfo );
	WaterRenderInfo_t info;
	DetermineWaterRenderInfo( fogVolumeInfo, info );
	g_ShaderEditorSystem->CustomViewRender( &g_CurrentViewID, fogVolumeInfo, info );

	// Disable fog for the rest of the stuff
	DisableFog();
  • 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

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.