Jump to content
Official BF Editor Forums


  • Posts

  • Joined

  • Last visited

About Coronaextra

  • Birthday 01/20/1982

Profile Information

  • Gender
  • Location
    Dallas, Texas

Recent Profile Visitors

14,741 profile views

Coronaextra's Achievements


Newbie (1/14)



  1. No, I don't really have a update on this. I can't improve the shading quality of the terrain any further until I have the ability to load extra maps and variables, so I am kind of waiting for BadSanta to finish his project, since any functionality I add in the future will use his system as a foundation. I posted a somewhat usable test version in a previous post on this thread. I'm sorry, I don't know anything about reshade. I don't remember ever saying this. The shader should work on all six terrain layers.
  2. Here is a fun little single seat VTOL aircraft I made. It is not based on anything in real life. I think it's a blast to fly around and kill bots with, so I thought I would share it. This vehicle and all of its contents are free to use for any BF2 project. Mod it however you want. Enjoy! MediaFire Download Link http://www.mediafire.com/file/g66skd4tcd6yiy5/Hoverbug.zip Moddb page http://www.moddb.com/games/battlefield-2/addons/hoverbug Comes with 3 textures sets (maybe more in the future if there is any interest). Sets are Woodland, Desert, and Arctic. All sets are 4096x4096, downsize them if that's too big for your project. Armament is: 2x M2HB machine guns with 500 rounds each 8 x wire guided minirockets with 2 reloads. Flarelauncher
  3. Yup, I tried a few different variants before I settled with what I'm suing now. Really, you can derive any component of the normal map with a heightmap but I preferred the cross multiply method because it derives the full normal map and uses only a few instructions. I actually got the idea from a material function in UE4/UDK called "NormalFromHeightmap". The version of the shader I'm using now has specularity turned off completely because it can't be controlled at the moment. It just uses the normal bump.I guess this would be called a "diffuse lambert" shader. You can see an example of it in the video I posted last page. I wanted to ask you a question though.. since you have obviously torn into the BF2 mesh files to make Meshview, I was wondering if you could confirm that staticmesh files do or do not contain vertex colors? I have been playing around with the staticmesh shader and I could not get it to output the vertex colors. Sometimes the EXE won't pass information like that to the shader if its not used for vanilla bf2.
  4. Hey just touching base!

  5. Jungle Project meets Shader Project! A day version of Hunter's Moon running the new normals shader. I also added improved envmap techniques for more realistic puddles. Not perfect but it's looking better every day. I also have a rough test version for you guys to try if you want. http://www.mediafire.com/file/5119a8a1iju36c9/TerrainNormals.zip
  6. In anticipation of using your new system, I have been experimenting heavily with the terrain system and I've come to the conclusion that the terrain mesh must have 6 instances of the terrain shader applied to it, one for each layer, because the terrain shader only loads a single detail texture, and uses a variable called "chartcontrib" as a means to blend between them. Have you confirmed any of that? And if so, is your system capable of passing unique textures into each of the shader instances?
  7. That's great news man, I'm super excited to try this. It should open up a whole world of possibilities for BF2 shaders. I have a few ideas on how to vastly improve the sky and water shaders using this. Does this allow new textures to be loaded in addition to the textures that are already loaded, or does it overwrite the existing samplers?
  8. Wow dude, that's awesome! So you are saying this works without the addition of your DLL hack or any other third party software?
  9. /// Global Variables float specularPower = 10; float fresnelPower = 3; scalar UVOffset = 0.005f; scalar NormalsIntensity = 20.0f; float3 lightDir = normalize(vec3(0.0f, 0.0f, -1.0f)); // Hardcoded light direction struct APP2VSEditorDetailTextured { float4 Pos0 : POSITION0; float2 TexCoord0 : TEXCOORD0; float4 Pos1 : POSITION1; float3 Normal : NORMAL; }; struct VS2PSEditorDetailTextured { float4 Pos : POSITION; float2 Tex0 : TEXCOORD0; float2 Tex1 : TEXCOORD1; float2 Tex2 : TEXCOORD2; float2 Tex3 : TEXCOORD3; float2 Tex4 : TEXCOORD4; float4 BlendValueAndFade : TEXCOORD5; float3 FogAndWaterFadeAndFade2 : TEXCOORD6; float2 BiFixTex : TEXCOORD7; float3 WorldPos : COLOR; ///////////////////////ADDED } VS2PSEditorDetailTextured vsEditorDetailTextured(APP2VSEditorDetailTextured indata) { VS2PSEditorDetailTextured outdata; float4 wPos; wPos.xz = (indata.Pos0.xy * vScaleTransXZ.xy) + vScaleTransXZ.zw; wPos.yw = (indata.Pos1.xw * vScaleTransY.xy) + vScaleTransY.zw; outdata.FogAndWaterFadeAndFade2.y = 1 - saturate((waterHeight - wPos.y)/3.0f); outdata.Pos = mul(wPos, mViewProj); float cameraDist = length(wPos.xz - camerapos.xz) + camerapos.w; float3 tex = float3((indata.Pos0.y * vTexScale.z), -(((indata.Pos1.x) * vTexScale.y)) , (indata.Pos0.x * vTexScale.x)); float2 xPlaneTexCord = tex.xy; float2 yPlaneTexCord = tex.zx; float2 zPlaneTexCord = tex.zy; outdata.Tex0 = yPlaneTexCord; outdata.BiFixTex = (yPlaneTexCord * vBiFixTex.x) + vBiFixTex.y; outdata.Tex1 = yPlaneTexCord * vNearTexTiling.z; outdata.Tex2 = yPlaneTexCord * vFarTexTiling.z; outdata.Tex3.xy = xPlaneTexCord.xy * vFarTexTiling.xy; outdata.Tex3.y += vFarTexTiling.w; outdata.Tex4.xy = zPlaneTexCord.xy * vFarTexTiling.xy; outdata.Tex4.y += vFarTexTiling.w; outdata.BlendValueAndFade.xyz = saturate(abs(indata.Normal) - vBlendMod); float tot = dot(1, outdata.BlendValueAndFade.xyz); outdata.BlendValueAndFade.xyz /= tot; float interpVal = saturate(cameraDist * vNearFarMorphLimits.x - vNearFarMorphLimits.y); outdata.BlendValueAndFade.w = saturate(interpVal * detailFadeMod); outdata.FogAndWaterFadeAndFade2.z = 0.5+interpVal*0.5; outdata.FogAndWaterFadeAndFade2.x = saturate(calcFog(outdata.Pos.w)); outdata.WorldPos = mul(wPos, mViewProj); ///Added return outdata; } float4 psEditorDetailTextured(VS2PSEditorDetailTextured indata) : COLOR { //////////// Vanilla Terrain Shading float4 staticColormap = tex2D(sampler0Clamp, indata.BiFixTex); float4 component = tex2D(sampler2Clamp, indata.BiFixTex); float4 lowComponent = tex2D(sampler5Clamp, indata.BiFixTex); float4 detailmap = tex2D(sampler1Wrap, indata.Tex1); float4 yplaneLowDetailmap = 2*tex2D(sampler3Wrap, indata.Tex2); float4 xplaneLowDetailmap = 2*tex2D(sampler3Wrap, indata.Tex3); float4 zplaneLowDetailmap = 2*tex2D(sampler3Wrap, indata.Tex4); float4 lightmap = tex2D(sampler4Clamp, indata.BiFixTex); float4 light = (lightmap.y * vSunColor*4) + (lightmap.z * vGIColor*2) + + (lightmap.x * vPointColor); float3 blendValue = indata.BlendValueAndFade.xyz; float fade = indata.BlendValueAndFade.w; float4 colormap = staticColormap; float chartcontrib = dot(componentsel, component); float4 lowDetailmap = lerp(1, yplaneLowDetailmap.z, lowComponent.x*indata.FogAndWaterFadeAndFade2.z); float mounten = (xplaneLowDetailmap.y * blendValue.x) + (yplaneLowDetailmap.x * blendValue.y) + (zplaneLowDetailmap.y * blendValue.z); lowDetailmap *= lerp(1, mounten, lowComponent.z); float4 bothDetailmap = detailmap * lowDetailmap; float4 detailout = 2 * lerp(bothDetailmap, 0.5*lowDetailmap, fade); float4 outColor = detailout * colormap * light; float4 waterOutColor = lerp(terrainWaterColor, outColor, indata.FogAndWaterFadeAndFade2.y); float4 fogWaterOutColor = lerp(FogColor, waterOutColor, indata.FogAndWaterFadeAndFade2.x); fogWaterOutColor.a = 1.0f; ////////// NEW STUFF ///////////////////////////////////// //// Derive normals from heightmap float2 OffsetA = float2(UVOffset,0); float2 OffsetB = float2(0,UVOffset); float2 AdjustedUVX = OffsetA + indata.Tex1; float2 AdjustedUVZ = OffsetB + indata.Tex1; float4 NormalTextureX = tex2D(sampler1Wrap, float2(UVOffset,0) + indata.Tex1).a; float4 NormalTextureY = tex2D(sampler1Wrap, indata.Tex1).a; float4 NormalTextureZ = tex2D(sampler1Wrap, float2(0,UVOffset) + indata.Tex1).a; float OffsetDifferenceA = (NormalTextureX.a - NormalTextureY.a) * NormalsIntensity; float OffsetDifferenceB = (NormalTextureZ.a - NormalTextureY.a) * NormalsIntensity; float3 AppendX = float3(1,0,OffsetDifferenceA); float3 AppendY = float3(0,1,OffsetDifferenceB); float3 TextureNormals = normalize(cross(AppendX,AppendY)); //// Basic phong shading using derived normals float4 LightingCalc; float3 worldEyeVec = normalize(indata.WorldPos.xyz - camerapos.xyz); float3 reflectionVector = - reflect(worldEyeVec, TextureNormals); float3 specular = .5 * pow(saturate(dot(reflectionVector, lightDir)), specularPower) * vSunColor; float3 lambert = saturate(dot(-lightDir, TextureNormals)); float3 fresnel = saturate(pow(saturate(dot(worldEyeVec, TextureNormals)), fresnelPower)) * (lambert + vGIColor); LightingCalc.rgb = (lambert + vGIColor) * fogWaterOutColor.rgb + specular + fresnel; ; LightingCalc.a = 1.0f; float4 Output; Output.rgb = LightingCalc.rgb; Output.a = 1; return Output * chartcontrib; }
  10. This is where I asked about adding new variables http://www.bfeditor.org/forums/index.php?/topic/14407-editing-shaders/&page=2 You seem to have some knowledge of BF2 shaders, so I'll explain the problems here. The problem is three fold: 1. Certain LightManager settings need to be passed into the shader for the lighting calculations to work properly, Currently the engine and editor will not do this because they were not programmed to do so. Some of these settings are declared in the shaders but remain empty and unused, possibly a remnant of an early un-optimized version of the game. Once DICE figured out what they needed for the vanilla shaders to function, they simply turned everything else off. The compiled EXE of the game will not use them or pass them to the terrain shaders. 2. Because the master shader for the mod is being edited, there is no control over the settings on a per map basis. Some of these settings don't exist in the game at all, and there would have to be a way to load them and inject them into the instance of the shader at runtime. Doing this for the editor probably would not work at all. Where I left off on this project, every one of the variables were hard coded, forcing the lighting additions to the terrain to be exactly the same across the entire mod, which isn't very useful. 3. Lack of specular maps. The shader loads a heightmap from the alpha channel of the detail map and derives the normals from that. This is really the only unused texture channel for the terrain (except when envmap technique is being used), leaving nothing left for loading specular maps. The only solution to this problem I've found is to "grey pack" the detail map, placing specular and env maps in the other channels. This would work fine, but it requires the user to sacrifice color detail maps. For some projects that wouldn't matter, for others it would be a deal breaker. To make no change means that specularity can't be controlled and it can look very bad at times. The loading issues could probably be solved with Python, but I know almost nothing about it, and it's a bit out of my wheelhouse. I am not a very good programmer and what I've achieved so far has been through a lot of trial and error. After you contacted me I copied over some code from another project that uses a similar system and I got the basics up and running again. I'll post the code below, have a go at it if you want.
  11. I assume you mean the terrain normals project? I haven't worked on that in a few years and I also no longer have the files for it. With some effort I could get it back to where it was but I would still run into the same problems as before. I posted about this problem in this forum and never received an answer. Until those problems are resolved I see no reason to continue with the project. Unfortunately there aren't a lot of people that know about BF2 shaders and at this point I would not even know who to ask.
  12. My first guess is that you still haven't packed everything up correctly. If you want, you can PM me a download link to your project and i'll take a look at it for you.
  13. Try this.. In the lights tweak change it from a spot light to a point light. change this ObjectTemplate.lightType Spot to this ObjectTemplate.lightType Point Also you could try this. I've discovered recently that you can get different results with different video cards and different video settings, so the light's I've made now use two different light types to "cover all bases". It seems to work well. ObjectTemplate.create Bundle Junglelight ObjectTemplate.createdInEditor 1 include Junglelight.tweak rem *** Generated with Bf2Editor.exe [created: 2016/9/25 23:57] ObjectTemplate.activeSafe Bundle Junglelight ObjectTemplate.modifiedByUser "Michael" ObjectTemplate.saveInSeparateFile 1 ObjectTemplate.createdInEditor 1 ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 0 rem ------------------------------------- ObjectTemplate.addTemplate Junglelight_LightSource_Spot ObjectTemplate.addTemplate Junglelight_LightSource_Point ObjectTemplate.addTemplate glow rem ------------------------------------- rem THIS LIGHTS EVERYTHING EXCEPT TERRAIN ObjectTemplate.create LightSource Junglelight_LightSource_Spot ObjectTemplate.modifiedByUser "Michael" ObjectTemplate.createNotInGrid 1 ObjectTemplate.createdInEditor 1 ObjectTemplate.lightType Spot ObjectTemplate.isDynamic 1 ObjectTemplate.castsStaticShadow 1 ObjectTemplate.castsDynamicShadow 1 ObjectTemplate.selfLights 1 ObjectTemplate.selfShadows 1 ObjectTemplate.supportsPerVertex 1 ObjectTemplate.supportsPerPixel 1 ObjectTemplate.supportsGlow 1 ObjectTemplate.supportsEmitter 1 ObjectTemplate.affectLightmappedObjects 1 ObjectTemplate.affectingType 0 ObjectTemplate.attenuationRange1 1 ObjectTemplate.attenuationRange2 10 ObjectTemplate.color 1.28667/0.773333/0 ObjectTemplate.speccolor 1.28667/0.773333/0 ObjectTemplate.HDRIntensity 1 ObjectTemplate.coneAngle1 20 ObjectTemplate.coneAngle2 22.5 ObjectTemplate.projectorTexture ObjectTemplate.projectorFov 1.0472 ObjectTemplate.projectorAspect 1 ObjectTemplate.projectorNear 0.001 ObjectTemplate.projectorFar 5 ObjectTemplate.enabled 1 ObjectTemplate.fov 8 ObjectTemplate.objectShadows 1 ObjectTemplate.shadowIntensity 1 ObjectTemplate.softness 4 ObjectTemplate.intensity 1.0 ObjectTemplate.flicker 0 ObjectTemplate.scale 1/1/1 rem THIS LIGHTS TERAIN AND NOTHING ELSE ObjectTemplate.create LightSource Junglelight_LightSource_Point ObjectTemplate.modifiedByUser tho ObjectTemplate.createNotInGrid 1 ObjectTemplate.createdInEditor 1 ObjectTemplate.lightType Point ObjectTemplate.isDynamic 1 ObjectTemplate.castsStaticShadow 0 ObjectTemplate.castsDynamicShadow 0 ObjectTemplate.selfLights 0 ObjectTemplate.selfShadows 0 ObjectTemplate.supportsPerVertex 0 ObjectTemplate.supportsPerPixel 0 ObjectTemplate.supportsGlow 0 ObjectTemplate.supportsEmitter 0 ObjectTemplate.affectLightmappedObjects 0 ObjectTemplate.affectingType 0 ObjectTemplate.attenuationRange1 0 ObjectTemplate.attenuationRange2 10 ObjectTemplate.color 1.0/0.773333/0 ObjectTemplate.speccolor 1.28667/0.773333/0 ObjectTemplate.HDRIntensity 1 ObjectTemplate.coneAngle1 20 ObjectTemplate.coneAngle2 22.5 ObjectTemplate.projectorTexture ObjectTemplate.projectorFov 1.0472 ObjectTemplate.projectorAspect 1 ObjectTemplate.projectorNear 0.001 ObjectTemplate.projectorFar 5 ObjectTemplate.enabled 1 ObjectTemplate.fov 8 ObjectTemplate.objectShadows 0 ObjectTemplate.shadowIntensity 0 ObjectTemplate.softness 0 ObjectTemplate.intensity 1.0 ObjectTemplate.flicker 0 ObjectTemplate.scale 1/1/1
  14. There are several threads in these forums that explain how to pack/load custom content in a map, here is one of them. The tutorial focuses on loading custom textures, but the concept is the same for any content. However, if the lightbundle is the only object you want to include with your map, creating archives and filemounts for it is unnecessary. You can place the content of the bundles con and tweak into your maps tmp.con file. The game will load any code from this file at runtime. ObjectTemplate.addTemplate Levels/MyMap/Objects/bp1_lamp_post_single_c/MyLightBundle.con the addtemplate command does not use a path. Only use the template name. If the template exists and it location is indexed with the filemount system, the game will find and load it.
  • Create New...