Coder Social home page Coder Social logo

irisshaders / iris Goto Github PK

View Code? Open in Web Editor NEW
3.3K 3.3K 621.0 55.42 MB

A modern shaders mod for Minecraft compatible with existing OptiFine shader packs

Home Page: https://irisshaders.dev

License: GNU Lesser General Public License v3.0

Java 99.63% GLSL 0.12% Shell 0.24%
hacktoberfest minecraft opengl shaders

iris's People

Contributors

altegar avatar altrisi avatar backryun avatar coderbot16 avatar coldice1605 avatar craftingmod avatar crsuh2er0 avatar dexman545 avatar disguys avatar douira avatar fayer3 avatar felix14-v2 avatar foundationgames avatar godgun968 avatar hj-zhtw avatar ims212 avatar isuewo avatar justsnoopy30 avatar klkq avatar kroppeb avatar lolothepro avatar madis0 avatar maximumpower55 avatar nocomment1105 avatar overlordsiii avatar pajicadvance avatar parzivail avatar peppercode1 avatar qouteall avatar thedocruby 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  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  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

iris's Issues

Possible integration with my mod, proper implementation for mc_Entity attribute?

Hello there, first off, thanks for that great project, this might be exactly what I'm looking for!

I'd like to base my own WIP project, LightOverhaul, on your shader implementation, since I need shaders as well. In a nutshell, I'm working on colored lighting (that, unlike Albedo and others doesn't bleed through walls). One part is the lighting engine reworks which is part of my mod, the other part is a shaderpack that takes advantage of that color information.
Currently I'm working on a hacked version of Optifine, but for various reasons I'm not too happy with that...

For my mod to work, I need to add two attributes for each block - skylightRGB and blocklightRGB. Since I don't know too much about the shader pipeline, it would be very useful for me to see how mc_Entity is implemented. Then I could (hopefully) work in the two custom attributes for my mod as well.

First Question, would be willing to implement mc_Entity so I could base my work on that? That would be very much appreciated!
And second question, would you be willing to accept a pull request for those two custom attributes once I got my mod and API finished?

Shadow mapping is not supported

Many shaderpacks require this to work properly. They'll run without it, but things won't look right.

  • Ability to orient the camera to point at the player from the current shadow light position
  • Configuring the projection matrix as required by the shaderpack
    • Orthographic projections (SHADOWHPL), used by most shaderpacks
    • Perspective projections (SHADOWFOV), legacy
  • Rendering the world (or parts of it) twice per frame: once for shadows, once normally
    • Ensure that this is implemented in a way that doesn't trip up other mods
    • Open question: should the events in WorldRenderEvents be fired for both the shadowmap rendering and standard world rendering, or only standard world rendering?
      • Canvas does not fire special world events when rendering shadows. This seems like sane behavior to replicate.
    • An initial implementation could focus only on rendering terrain and perhaps the player entity, since those are the most important things for shadows.
  • Render to special shadow render targets and then make the render target content available to other shaders
  • Decent shadow culling
    • I discussed shadow culling with Grondag a while back. Essentially, the only chunks that should be considered for shadow rendering are chunks that are (a) directly visible to the player or (b) potentially occluding (ie, casting shadows on) chunks directly visible to the player from the perspective of the sun / moon
    • Based on the absolutely abysmal performance of shadow rendering with most shaderpacks on OptiFine (some shaderpacks spend 50% of the CPU time on shadow rendering, and probably a bit of GPU time too!), I'm going to guess that it just flat out does not cull anything during shadow rendering. This is likely to solve the "why is the mountain behind me not casting a shadow" problem, but it results in very poor performance.

Parse `const`-style directives from shader source files properly

OptiFine/ShadersMod both allow shaderpacks to supply directives and configuration by declaring constants in the shader files. Here is an example: https://github.com/sp614x/optifine/blob/master/OptiFineDoc/doc/shaders.txt#L388

const float shadowDistance = 160.0f;

ShadersMod uses the following logic to locate that directive on each line:

  1. Match any number of space/tab characters (including zero)
  2. A const literal
  3. Match any number of space/tab characters (including zero)
  4. A float literal
    • Naturally this will differ for directives of different types - it could be bool, int, vec4, etc.
  5. Match any number of space/tab characters (including zero)
  6. A literal containing the name of the directive, in this case shadowDistance
    • Again, this will differ for each directive
  7. Match any number of space/tab characters (including zero)
  8. A literal = character
  9. Match any number of space/tab characters (including zero)
  10. Optionally match a negative sign (-), since these values can be negative
  11. Any digit or . character. There must be at least one digit for the directive to be valid.
    • Technically ShadersMod will match const float shadowDistance = .; as well but obviously that isn't valid. It's okay for Iris to ignore that case.
  12. Optionally match a float type suffix (f), for example the f in 160.0f
    • Naturally this will differ for directives of different types.
  13. A literal ; character
  14. Any character (ShadersMod doesn't care about anything that comes after the semicolon)

Of course, the above logic is tailored to float values. Boolean, integer, vec4, and other types directives will need slightly different logic.

The above logic could be implemented as a regular expression, however it is also possible to implement it without regex. It's possible that an implementation that doesn't use regex could be more readable and understandable.

Lack Of Shadow Mapping Support

When using any shader pack, lighting will refuse to work correctly and will only show as vanilla lighting. I've tried all of sildurs shader packs yet none of them will work right.

I have yet to find out why, but I think it might be because of my NVIDIA card...? As looking at other issues I see people using AMD cards/apus with no problems.

Java 15
Using Minecraft 1.16.4
Fabric Loader 0.11.1
There are no other mods installed other than Iris

Also the multimc logs show a lot of errors: https://pastebin.com/RzQat5BN

I got deceived by a screenshot taken at sunset which made it look the lighting was working perfectly fine for someone else. Man im a little stupid sometimes. The real reason was because of the lack of shadow mapping support.

Screenshots of lite and high:
2021-01-18_22 20 03
2021-01-18_22 34 29

With "Iris" mod i can't see the mob hurt red color

In a regular game, if i hit the mob it will turn red for a second, but with Iris (im running ./gradlew runclient) they don't turn red! This isn't a big issue, but still feels uncomfortable. This issue is happening with any shaderpack, even with (internal).
Can't record a video, but here is a screenshot =))))
2021-01-04_21 47 02

Iris+sodium on AMD = that...

2021-01-08_20 42 11
I understand that mod doesn't support sodium now, but i've seen ppl using it with sodium and having almost 0 problems =)

How to build?

Hi! I'm looking to build this project, but I don't quite get it.

When I run gradlew build, I get this error :

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 809ms

Bugs with internal shaders

  • Clouds are black
  • No block outline
  • Entities don't turn red when you punch them
  • The sun / moon show up behind the skybox

Spider eyes don't render quite right on Sildur's Vibrant Shaders

On trunk they don't use the right render layer, and on my local testing branch making spider eyes render properly causes the rest of the spider to turn black.

This appears to result from the fact that the spider eyes renderer actually renders the whole spider model, but normally only the eyes part should show up.

This might be related to issues with transparency in general that I've noticed with faraway leaves as well.

[Slidur's] World goes black when looking straight up

When I face directly upwards, all blocks become black. The sky is not affected.
It happens with all the Slidur's packs except Enhanced Default. It does not happen with (internal)
shaders.

Examples:
image image

image image

image
When my vertical angle is between -89.0 and -89.9, the world flickers when I look around.
It is completely black when I am facing directly upwards at -90.0.

Tracking issue for sodium compatibility

Known issues:

  • Can't reload terrain / water shaders (it says successful, but the terrain shaders in use aren't changed)
  • Fog culling should be disabled for now because many shaders don't use fog, or use custom behavior
  • Translucent blocks render incorrectly (all bunched up) with AMD on Windows with some shader packs
    • This appears to be an issue with the Sildur's gbuffers_water in particular - if you delete gbuffers_water the water no longer gets bunched up but obviously it looks wrong in different ways because it's the wrong program
  • ftransform() is not properly replaced

EXCEPTION_ACCESS_VIOLATION (0xc0000005) Crash

I know this isn't fully about Iris, but I hope you guys could tell me I should do in this situation. I pasted the issue I posted on the MultiMC Github here:

System Information

MultiMC version:
0.6.11-1430 on win 32 - MultiMC 5

Operating System:
Windows 10

Summary of the issue or suggestion:
MC Launches, Loads, and then right before the title screen fully shows it crashes

What should happen:
Obviously MC shouldn't crash

Steps to reproduce the issue (Add more if needed):

  1. Launch Minecraft

Suspected cause:
Iris or Sodium, but IDK (I know that it's not now, this is just the copied issue)

Logs/Screenshots:
Log
[Screeenshot](img.justpaste.me/i/20210107/kxV1z/Screenshot 2021-01-07 080827.jpg)

Now I know it's about AMD and atio6axx.dll or whatever, I just want to know what to do right now. Please help me if you can.

New and "Easy" Uniforms

uniform float viewWidth; viewWidth
uniform float viewHeight; viewHeight
uniform float near; near viewing plane distance
uniform float far; far viewing plane distance
These uniforms should be easy to add and many basic shaders use them for DOF and other effects.

Item rendering | Folder structure | Crash

Hey, there,
I just discovered this project via this gist, and I have to say, I am very happy, that somebody is working on an alternative to Optifine.
Firstly, I just started up my client, and my first question is: How and do I have to put the shaders in a folder? Just extract the shader zip or copy the "shaders" folder out?
Next: Items/Player(s) aren't rendered correctly. The Player's hand is invisible, the Player iself and many items are kinda seethrough.

Screenshot_20210106_214247
Screenshot_20210106_214304
Screenshot_20210106_214621

The red screenshot is from the Limbo (to demonstrate the translucency), don't ask me why.
The few seconds, it actually worked, I tried to use the Complementary shaders. - More or less as a joke.
After this I always get this fancy crash here: log.txt so I couldn't test any other shaders...

Thanks for this project!

Various issues with vanilla vertex normal calculations

Minecraft already calculates vertex normals for most geometry, but the vertex normals it calculates have some issues:

  • Diagonal block models (such as tall grass) don't have properly rotated vertex normals
  • Fluids (water and lava) have incorrect vertex normals, they always point up even for side and bottom faces
  • Entity and BlockEntity vertex normals change as the camera rotates - camera rotation should not be considered in vertex normal calculation

For finding these issues, the following shader files are useful:

gbuffers_textured.vsh:

#version 120

varying vec4 color;

void main() {
    gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;

    color = (vec4(gl_Normal, 1.0) + vec4(1.0, 1.0, 1.0, 1.0)) / 2.0;
}

gbuffers_textured.fsh:

#version 120

varying vec4 color;

void main() {
    gl_FragColor = color;
}

Iris disables the vanilla water overlay

From #42:

BTW, talking about fluids, Iris internal currently removes the vanilla effect of being submerged in fluids, not sure if that's known (although according to the debugger, that applyFog function is still called).

blockEntityId and entityId uniforms are almost certainly broken

Minecraft renders block entities and regular entities substantially differently in 1.15+ compared to previous versions. As such, it's much harder to track exactly what entity is currently being rendered, since entities are often drawn to the screen whenever a different entity starts being rendered.

The reason for this is how VertexConsumerProvider.Immediate works: with the exception of a few special render layers, whenever entity render layers are switched the content of the previous layer is immediately drawn to the screen.

It's unclear whether uniforms even work here anymore. Maybe attributes will need to be used? That would require some pretty hacky code changes to shaders however.

Add a GPU-side profiler

The vanilla CPU profiler doesn't tell the whole story. Especially in GPU-bound situations, it can be hard to tell how much time the GPU is spending on everything.

This is possible on OpenGL 2 and above using Query Objects.

Shadow map rendering

Most shaderpacks require shadow mapping, but Iris doesn't support it. This should be implemented at some point.

Compatibility issue with Voxelmap

Waypoint indicators render as a regular square when using Sodium and Iris together. I need to see if this can be reproduced without Sodium. I'm guessing that since we revert back to gbuffers_basic for unknown content, that is what is causing the issue.

Make a progress tracking issue

It would probably be helpful for developers trying to contribute to have a "checklist" issue with a list of things that are needed to be implemented and the ones that already are. That would allow them to know what to work on without having to look through the entire source to find those spots, or to see things needed in case they don't know what actually needs to be implemented.

Another option would be making an issue for each feature and then adding those to a Project, which could even be organized in categories like To do, In progress or Done. Projects can also take regular texts ("cards") that aren't linked to any issue, but having each as an issue (or PR) allows for a description, discussion, someone saying "working on it", or assigning them to users. Projects can also be automated, so things like closing those issues or merging the PRs can automatically move them to Done.

Maybe a mix of both (tracking issue with a list and then project with linked issues for started/considered "important" at the moment), in case you like Projects but don't want to have the issues tab filled (although that's what it is for, isn't it?).
Another way could also be cards for those that "don't need discussion (yet)", and asking to replace them with an issue/draft PR in case someone wants to work on them or discuss them.

Disclaimer: I don't know anything about shader code, and probably won't be able to contribute, but I may if I'm bored enough.

Possibly add tests

We've already have had multiple bugs pop up. Maybe its a good idea to have tests.

Correctly handle entries in block.properties involving blockstates

OptiFine supports block states (instead of just blocks) in block.properties, we should too. This causes a lot of logspam with Sildur's and similar packs otherwise.

It's not 100% clear how to make this work seamlessly, consider the following examples:

block.0 = minecraft:stone_slab[half=top]
block.1 = minecraft:stone_slab[half=bottom]
block.0 = minecraft:stone_slab

We'll need to support both cases, because sometimes shaderpacks choose to differentiate based on state and sometimes they do not depending on the given block.

Add a donation link

You could create a discord server and a link to donate to support the project
this would be great
I know this isn't really an issue but I didn't know where to post it

Sildur's TAA is completely broken on Iris

TAA disabled:

TAA disabled

TAA enabled:

TAA enabled

Disabling TAA within composite2.fsh alone (and leaving it enabled for all other shaders) fixes the issue, so the problem likely lies somewhere in there.

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.