Comments (12)
As you can see, the remote player doesn't have a light source. I tried looking, but couldn't find where the light of the player is, as even disabling the player, the light remains. If anyone can find it, let me know.
from nebula.
It seems that Guiding light is being toggled in UIGameMenu by:
public void OnDfLightButtonClick() { PostEffectController.headlight = !PostEffectController.headlight; }
And then actual light is renedered by shader in PostEffectController:
Vector3 position = mainPlayer.position; Shader.SetGlobalVector("_Global_PointLightPos", new Vector4(position.x, position.y, position.z, 1f));
from nebula.
But since the light is made by Shader using a global variable, I am not sure how to add a second instance of the light. Maybe a workaround would be attaching a light source above the mech model, but that would not look that nice.
from nebula.
I'm don't know how unity stores shaders, but maybe we can extract the shader code, modify it, and then reassign it? Unless ofcourse only the compiled shader code is stored.
from nebula.
I believe you would have to somehow duplicate the shader and change the name of the input variable. Shaders need to be compiled beforehand if I am not mistaken.
- One solution could be to create multiple shaders and just change the input variable to "
_Global_PointLightPos2
", "_Global_PointLightPos3
", etc... and assign it to each player. Bur, I cannot guess how much effort would this take.
Maybe some Guru will have a better idea of how to solve this? :D
from nebula.
The easiest way would be to try adding a point light gameobject as a child of the remote players and look if it works. If it doesn't, we can add and load custom shader by using asset bundles.
from nebula.
I was able to extract 199 shader files files from the assets, but they are semi-compiled I believe, I found 3698 references to _Global_PointLightPos
spread over 44 files. On closer inspection, the header data of the shaders seem to be somewhat intact, but all the actual shader-code is always in a single main function. All of the variable names are also stripped.
So in essence, i have 200 files of each between 1 and 10 thousand lines of:
u_xlat11.xyz = u_xlat2.xyz + vec3(-1.0, -1.0, -1.0);
u_xlat11.xyz = u_xlat0.xxx * u_xlat11.xyz + vec3(1.0, 1.0, 1.0);
u_xlat8.xyz = u_xlat8.xyz * u_xlat11.xyz;
u_xlat28.x = u_xlat28.x * u_xlat42 + 0.0318309888;
u_xlat8.xyz = u_xlat28.xxx * u_xlat8.xyz;
u_xlat11.xyz = u_xlat3.xyz + vec3(u_xlat46);
u_xlat8.xyz = u_xlat8.xyz * u_xlat11.xyz;
if(u_xlatb44){
u_xlat28.x = u_xlat45 + -20.0;
u_xlat42 = u_xlat28.x;
u_xlat42 = clamp(u_xlat42, 0.0, 1.0);
u_xlat42 = u_xlat50 * u_xlat42;
u_xlat4.xyz = (-u_xlat4.xyz) * u_xlat28.xxx + _Global_PointLightPos.xyz;
u_xlat28.x = dot(u_xlat4.xyz, u_xlat4.xyz);
u_xlat28.x = sqrt(u_xlat28.x);
u_xlat44 = (-u_xlat28.x) + 40.0;
u_xlat44 = u_xlat44 * 0.0250000004;
from nebula.
I've tested adding Light to the player but there is a big artefact.
What we could probably do, is create our own shader for remote player lighting and add a custom post effect of this shader on the main camera.
from nebula.
I have done some digging and I more or less understand how it is done now. The light effect is done by a global variable that is used in all shaders for all materials that receives this light. In this way, they can control how this light will interact with different materials (leaves, water, surface, etc.). Since it is used in 44 shaders in almost 44 different ways, it is not possible to do it in the same way.
I am still trying to find out, what is causing this artifact and if there is some way how to bypass it.
@hubastard: If you attach the shader to the main camera, you can only control the brightness of the pixels around the player right? I am not sure if you would be able to do some projection onto the surface to highlight only the surface. Otherwise, I think you would be also highlighting the pixels that belong to "air", so if players rotate the camera close to the horizon. There will be always a circle of highlighted pixels around the player, right?
from nebula.
Yeah I think you are right.. I will try to see if I can find a way to get almost the same look somehow..
from nebula.
Regarding the initial issue, that one player does not receive light from another player. I think it is caused by some issues with the model\shaders on the model. I was checking it, but I am not exactly sure why.
From each player's perspective, his model receives more lights than models of other players so all other players look more darker.
The arrow shows from which player's perspective I have made the screenshot.
from nebula.
Will not fix. Since this would require changing the entire shader code of the game.
from nebula.
Related Issues (20)
- Nebula does not work with 0.10.x HOT 10
- Sync the new StorageComponent.SetFilter(int,int)
- Unsynchronized counter for PLS and ILS leads to accidental linking HOT 1
- BepInEx Version HOT 1
- Nebula not compatible with version 0.10.28.x HOT 1
- Is there any chance this project will evolve into a decoupled server? HOT 2
- Unable to launch the game properly! HOT 2
- Whether to consider compatibility with dark fog? HOT 1
- The effect of turning on sandbox mode will be retained in the branch of Black Mist Online HOT 5
- Dark Fog bug HOT 5
- Planetary Shield can't stop the Dark Fog Repeater from landing HOT 7
- The threat percentage of client players cannot be displayed correctly HOT 2
- [Headless] newgame HOT 3
- When connected player is attacked the shield of host player is also reduced
- Discord Activity not starting (Cracked Game Version) HOT 1
- can't setup headless server HOT 1
- Mod not compatible with new update HOT 4
- [Headless] The host seems unaware of clients threat generation. HOT 2
- Error when loading the save games HOT 5
- Thread percentage of clients stays at zero
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nebula.