Skip to content

Method OpenGLSurface.set_fill_by_value() colors surface a single color #2173

Closed
@alembcke

Description

@alembcke

Description of bug / unexpected behavior

When using OpenGLSurface.set_fill_by_value() the entire surface is given a single color.

Expected behavior

.set_fill_by_value() should color the surface based on the z-value of the axes.

How to reproduce the issue

Code for reproducing the problem
from manim import *
from manim.opengl import *


class Test(ThreeDScene):
    def construct(self):
        resolution_fa = 100
        self.set_camera_orientation(phi=75 * DEGREES, theta=-30 * DEGREES)

        axes = ThreeDAxes(
                x_range=(-3, 3, 1),
                y_range=(-3, 3, 1),
                z_range=(-5, 5, 1)
                )

        def param_saddle(u, v):
            x = u
            y = v
            z = y**2/2 - x**2/2
            return z

        saddle_plane = OpenGLSurface(
            lambda x, y: axes.c2p(x, y, param_saddle(x, y)),
            resolution=(resolution_fa, resolution_fa),
            u_range = (-3, 3),
            v_range = (-3, 3)
        )

        saddle_plane.set_fill_by_value(axes=axes, colors=[BLUE, GREEN, YELLOW, ORANGE, RED])
        self.add(axes, saddle_plane)

        self.interactive_embed()

Additional media files

Images/GIFs

Test_ManimCE_v0 11 0

System specifications

System Details
  • OS: Ubuntu 21.04
  • RAM: 32GB
  • Python version (python/py/python3 --version): 3.9.5
  • Installed modules (provide output from pip list):
Package                 Version
----------------------- ---------------------
manim                   0.10.0
moderngl                5.6.4
moderngl-window         2.4.0
FFMPEG

Output of ffmpeg -version:

ffmpeg version 4.3.2-0+deb11u1ubuntu1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Ubuntu 10.2.1-20ubuntu1)
configuration: --prefix=/usr --extra-version=0+deb11u1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100
libpostproc    55.  7.100 / 55.  7.100

Additional comments

The current implementation seems to have been copied from Surface.set_fill_by_value() which colors individual squares making up the surface as just one color each. As OpenGLSurface is made up of triangles, which can be colored using a gradient, it would be good if the individual triangles were colored by gradient to give a smooth gradient effect compared to each triangle being one color.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue:bugSomething isn't working... For use in issuesopenglConcerning the OpenGL renderer.

    Type

    No type

    Projects

    Status

    ❌ Rejected

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions