Giter Site home page Giter Site logo

source1import's Introduction

source1import

Set of scripts for importing Source 1 assets such as materials, models, and particle effects into Source 2. Inspired by Valve's own import utility also named source1import.

The main difference is this one is open source so you can customize it (i.e. use different shader sets).

Based off of source2utils.

Warning

This tool has a number of disadvantages over the built-in CS2 Import Scripts. Including:

  • No PBR material conversion. So your textures will look dark and flat.
  • No map converter.
  • Cannot filter assets by map.

Note

However there may be some features you might find useful such as:

  • Support for texture ANIMATION
  • Support for SKYBOX materials
  • Support for material proxies (quite basic, but this one for example works)

Usage

Download from here: Releases

Note:

  • Make sure to move the entire s1 models folder to content/ before importing.
  • Make sure to move the entire s1 sound folder to content/ and rename it to sounds. No import necessary.
  • Make sure to have gameinfo.txt present in Import Game.
  • Make sure to read this guide for importing map files.
  • Materials won't be PBR ready. so you need to use some other post-conversion tool.

Advanced Usage:

CLI:

cd utils
python scripts_import.py   -i "C:/.../Team Fortress 2/tf" -e "D:/Games/steamapps/common/sbox/addons/tf_source2" -b sbox
python particles_import.py -i "C:/.../Portal 2/portal2" -e "C:/.../Half-Life Alyx/game/hlvr_addons/portal2"
python scenes_import.py    -i "C:/.../Half-Life Alyx/game/lostcoast" -e hlvr_addons/lostcoast
python models_import.py    -i "C:/.../Half-Life Alyx/game/l4d2" -e l4d2_source2
python materials_import.py -i "C:/.../Half-Life Alyx/game/ep2" -e hlvr  "materials/skybox"
  • -i <dir> This should be an absolute path pointing into a source1 game directory containing gameinfo.txt
  • -e <dir/modname> Path to source2 mod/addon folder. <modname> (short notation also allowed e.g. -e portal2_imported, provided the game folders sit next to eachother)
  • -b <branch> Switch to a different branch. Default is hlvr. Other branches include steamvr adj sbox cs2 dota2, ordered by magnitude of support.
  • [filter] Optionally a path at the end can be added as a filter.

Requirements (dev):

  • Python >= 3.10
  • pip install -r requirements.txt

Results

* maps converted via built-in hammer 5 funcionality

source1import's People

Contributors

alpynedreams avatar caseytube avatar dependabot[bot] avatar kristiker avatar rectus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

source1import's Issues

adj: propdata has moved to kv3

hlvr accepts it as-is (this is also unhandled)

File location: scripts/propdata.vdata

<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
	generic_data_type = "prop_data"
	Cardboard.Base = 
	{
		_not_pickable = 1
		dmg.bullets = 0.500000
		dmg.club = 1.250000
		dmg.explosive = 1.500000
	}
	Cardboard.Small = 
	{
		dmg.bullets = 0.500000
		dmg.club = 1.250000
		dmg.explosive = 1.500000
		_base = "Cardboard.Base"
		health = 10
	}
	Cardboard.Medium = 
	{
		dmg.bullets = 0.500000
		dmg.club = 1.250000
		dmg.explosive = 1.500000
		_base = "Cardboard.Base"
		health = 20
	}
}

Windows Executable vs. Map files

So, the windows binary has been working flawlessly, except for the major exception of trying anything with maps, compiled or otherwise, python dependencies or otherwise. it all ends the same way:

Searching for unimported .vmf files...
File "source1import.pyw", line 97, in run
File "maps_import.py", line 33, in main
File "maps_import.py", line 51, in ImportVMFEntitiesToVMAP
File "maps_import.py", line 73, in convert_vmf_entities
File "maps_import.py", line 105, in create_fresh_vmap
File "shared\datamodel.py", line 802, in load
Failed! Something went wrong with the maps_import module!
-> ["FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Sentry\\AppData\\Local\\Temp\\_MEI271922\\utils\\shared\\empty.vmap.txt'\n"]

anyone got a fix?

Texture Importing uses smallest mipmap

When exporting a vtf that has mipmaps to source2, source1import either exports all mipmaps as the same file, replacing the correct file everytime, or just exports the smallest mipmap. Major issue for map porting, plz fix.

Can include-d materials be converted to `vmat_prefab`?

vmat_prefab is avaliable in latest dota 2. This new asset type defines base parameters that materials can inherit, similar to source 1 Patch. Difference is vmat_prefab does not compile to vmat_c. There is no documentation or any example usages.

if includePath := vmt.KeyValues["include"]:

This file in samples is a good example.

VertexlitGeneric
{
$vertexfog 1
$treeSway 1
$treeSwayHeight 60
$treeSwayStartHeight "0.5"
$treeSwayRadius "0.5"
$treeSwayStartRadius "0.25"
$treeSwaySpeed "0.8"
$treeSwayStrength "0.3"
$treeSwayScrumbleSpeed "0.8"
$treeSwayScrumbleStrength "0.1"
$treeSwayScrumbleFrequency 8
$treeSwayFalloffExp 20
$treeSwayScrumbleFalloffExp 20
$treeSwaySpeedHighWindMultiplier 2
$treeSwaySpeedLerpStart "2.0"
$treeSwaySpeedLerpEnd "6.0"
}

Materials included by map-specific patches not as much.

Bug with converting sky texture

When converting sky textures, I get these messages:

Searching for .vmt files...
missing sky face: materials\skybox\legacy_faces\docks_hdrbk.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrdn.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrft.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrlf.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrrt.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrup.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrbk.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrdn.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrft.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrlf.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrrt.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrup.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrbk.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrdn.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrft.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrlf.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrrt.pfm
missing sky face: materials\skybox\legacy_faces\docks_hdrup.pfm
......
Collected face BK for sky_l4d_c4m4_hdr_cube.tga
Collected face DN for sky_l4d_c4m4_hdr_cube.tga
Collected face FT for sky_l4d_c4m4_hdr_cube.tga
Collected face LF for sky_l4d_c4m4_hdr_cube.tga
Collected face RT for sky_l4d_c4m4_hdr_cube.tga
Collected face UP for sky_l4d_c4m4_hdr_cube.tga
......
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrbk.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrdn.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrft.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrlf.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrrt.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrup.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrbk.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrdn.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrft.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrlf.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrrt.pfm
missing sky face: materials\skybox\legacy_faces\urbannightburning_ldrup.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrbk.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrdn.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrft.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrlf.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrrt.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrup.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrbk.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrdn.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrft.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrlf.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrrt.pfm
missing sky face: materials\skybox\legacy_faces\urbannightstorm_ldrup.pfm

By the way, these sky textures are from L4D2's HD Sky Textures mod.

There seems to be a problem importing sky material from Half-Life 2.

Only a few sky materials can be imported properly and a few textures can be converted:
Successfully converted material:
sky_borealis01
sky_day01_01
sky_day01_01_hdr
sky_day01_04
sky_day01_04_hdr
sky_day01_05
sky_day01_05_hdr
sky_day01_06
sky_day01_06_hdr
sky_day01_07
sky_day01_07_hdr
sky_day01_08

adj: Nice mipmap filtering on albedos

Source uses Nice which makes those textures sharp, but Source 2 has Box as default. However in adj you can switch algorithms

example txt

"settings"
{
	"mip_algorithm"		"Nice"
	"mip_filter_strength"		"1.000000"
	"nolod"		"1"
}

image

Support `$bumpframe` animated normal

I think animation parameters in complex and others work on the whole material (so all the maps). S1import currently only supports $frame (albedo).

animatedtexture
{
animatedtexturevar "$normalmap"
animatedtextureframenumvar "$bumpframe"
animatedtextureframerate "30.0"
}
texturescroll
{
texturescrollvar "$bumptransform"
texturescrollrate "0.05"
texturescrollangle "45.0"
}

Material is pitchblack from auto-generated dynamic expression

When porting a bunch of tf2 models I realized the material is pitch black but when removing the dynamic expression that's auto-generated, it works. I don't know if there is a setting already to turn it off when porting but it would nice to have it instead of deleting it manually.

Support indexed dynamic param

s1:

  • proxy1 $resultvar "$color[0]"
  • proxy2 $resultvar "$color[1]"

s2:

  • g_vColorTint "a.x = proxy1; a.y = proxy2; return a"

Scale transform isn't handled for skyboxes

sky_dustbowl_01's side textures look like this:
image

but they get scaled to cover the whole square in the vmt

"sky"
{
	
	"$hdrcompressedTexture" "skybox/sky_dustbowl_01_hdrside"	
	"$nofog" "1"
	"$ignorez" "1"
	"$basetexture" "skybox/sky_dustbowl_01side"
	"$basetexturetransform" "center 0 0 scale 1 2 rotate 0 translate 0 0"
	"%keywords" "tf"
}

Material conditionals lacking priority

The orange towers in de_dust2 look different with high gpu settings. S1Import does not prioritize higher order values and uses last key seen on file. Similar thing with _dx9 and hdr_dx9 blocks lacking a priority system.

// Sets the value when Shader Detail is High or higher
"GPU>=2?$color" "[ 1 0 0 ]" // Quoted parameter because of equal sign.
GPU<2  // Sets the values in the block if Shader Detail is below High.
{
	$envmap	env_cubemap
	$color "[ 0 0 1 ]"
}

Postprocessing files

There is a scripts/postprocess.txt file that could be split into .vpost.

"post_process"
{
	"low_health"
	{
		"localcontrast"			"0.52"
		"edgelocalcontrast"		"0.0"
		"vignettestart"			"0.6"
		"vignetteend"			"1.0"
		"vignetteblur"			"0.05"
		"fadetoblack"			"0.0"
		"depthblur_focaldist"		"0.0"
		"depthblur_strength"		"0.0"
		"screenblur_strength"		"0.0"
		"filmgrain_strength"		"1.0"
	}
}

Monitor (_rt_) textures for games that have them.

This material could be converted to vr_monitor.vfx with return $MonitorTexture dynamic-exp.

"vertexlitgeneric"
{
    "$basetexture" "_rt_camera1"
    "$model" 1
    "$selfillum" 1
    "$selfillumtint" 2
    "$bumpmap" "models/shared/n_flat"
    "$nodecal" 1

    "$envmap" "env_cubemap"
    "$normalmapalphaenvmapmask" 1
    "$envmaptint" 0.75

    "$phong" "1"
    "$phongexponent" 200
    "$phongboost" "2.5"
    "$phongfresnelranges"    "[0.5 1 3]"

    "VertexlitGeneric_HDR_DX9"
    {
    "Proxies"
    {

        "Sine"
        {
            "resultVar" "$selfillumtint[2]"
            "sineperiod" 1
            "sinemin" 0.4
            "sinemax" 0.6
        }
        "Sine"
        {
            "resultVar" "$selfillumtint[1]"
            "sineperiod" .01
            "sinemin" 0.5
            "sinemax" 0.7
        }
        "Sine"
        {
            "resultVar" "$selfillumtint[3]"
            "sineperiod" .01
            "sinemin" 0.7
            "sinemax" 0.8
        }
    }
    }
    "VertexlitGeneric_DX9"
    {
    "Proxies"
    {

        "Sine"
        {
            "resultVar" "$selfillumtint[2]"
            "sineperiod" 1
            "sinemin" 0.7
            "sinemax" 0.9
        }
        "Sine"
        {
            "resultVar" "$selfillumtint[1]"
            "sineperiod" .01
            "sinemin" 0.8
            "sinemax" 1
        }
        "Sine"
        {
            "resultVar" "$selfillumtint[3]"
            "sineperiod" .01
            "sinemin" 1
            "sinemax" 1.2
        }
    }
    }

     "vertexlitgeneric_dx8"
    {
        "$fallbackmaterial" "models/spire/broadcast/punk_monitor1_dx8"
    }
}

$ssbump support?

At least in S&Box, there is a "Enable Self-Shadow" feature, as far as I can tell, it solves most inconsistencies...
https://developer.valvesoftware.com/wiki/$ssbump

F_ENABLE_NORMAL_SELF_SHADOW 1
g_flLightRangeForSelfShadowNormals "1.000"

This is how I set mine to in order to properly display them, the default that sbox sets g_flLightRangeForSelfShadowNormals to is .707

Can't convert CS:GO models to S&Box.

Was trying to convert materials, models, particles, sounds and scripts to Source 2 for S&BOX but it gave me the error that it couldn't find any .mdl files even though they are present in the files. Not really sure what's going wrong here but would appreciate it if you could let me know what to do. Thanks very much!

Drag & drop helper

Drag an asset over the window to populate the in-path, filter, and options automatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.