Code Monkey home page Code Monkey logo

crt's Introduction

Software composite video modulation/demodulation experiments

The idea is to reproduce in GLSL shaders realistic composite-like artifacting by applying PAL modulation and demodulation. Digital texture, passed through the model of an analog channel, should suffer same effects as its analog counterpart and exhibit properties, such as dot crawl and colour bleeding, that may be desirable for faithful reproduction of look and feel of old computer games.

The project contains 2 main parts: purely software simulation, and GLSL shader implementation. The GLSL part consists of a Python host which can be used to experiment with fragment shaders in general, and the shaders themselves.

Shaders

Currently there are 3 different implementations of composite shader that aim to reproduce the same model.

mpass

3-stage processing:

  1. modulate source RGB signal to B&W image
  2. demodulate U and V, pass (Modulated, U, V) in (R,G,B) channels
  3. lowpass filter UV at baseband, remodulate again and subtract from Modulated to recover Luma. Convert back to RGB

oversampling

SDLMESS uses very small textures for multipass shading, which makes them not very practical for purposes of storing intermediate values. This method is an attempt to pack 2x more intermediate values in unused texture channels. It differs from mpass in that it passes U,V,U,V in (RGBA), thus packing 2x more bandwidth in same amount of pixels.

singlepass

I was afraid that this method would be very slow because a lot of things are calculated over and over again for the purpose of filtering. But it seems to be doing fine even on slower GPUs. This is the best method. Because it has no intermediate passes, it takes colour signal samples at 4x colour subcarrier frequency regardless of source texture resolution.

Requirements:

  • Software-only model: Python 2.7, PyPNG
  • GLSL model: Python 2.7, PyGame, PyOpenGL

SDLMESS/SDLMAME compatibility

This toy is designed with SDLMESS compatibility in mind, so shaders designed with it can be used with SDLMESS almost without modifications.

Acknowledgements

crt's People

Contributors

svofski 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

00mjk clayne

crt's Issues

dont work secam

each times i run process.py :::
Traceback (most recent call last):
File "process.py", line 372, in
process_file(inputfiles[0])
File "process.py", line 353, in process_file
s.run()
File "process.py", line 320, in run
secam,sel = self.modulate(rgb_samples[:count], line[:count])
File "process.py", line 271, in modulate
self.probe_sink.work(probnik)
File "/home/pi/CRT/SECAM/imagesink.py", line 27, in work
self.savePng(frame)
File "/home/pi/CRT/SECAM/imagesink.py", line 49, in savePng
writer.write(f, rows)
File "/usr/local/lib/python3.5/dist-packages/png.py", line 670, in write
nrows = self.write_passes(outfile, check_rows(rows))
File "/usr/local/lib/python3.5/dist-packages/png.py", line 704, in write_passes
return self.write_packed(outfile, rows)
File "/usr/local/lib/python3.5/dist-packages/png.py", line 736, in write_packed
for i, row in enumerate(rows):
File "/usr/local/lib/python3.5/dist-packages/png.py", line 662, in check_rows
(vpr, len(row), i))
png.ProtocolError: ProtocolError: Expected 768 values but got 2304 value, in row 0
/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_gtk3.py:181: Warning: Source ID 8 was not found when attempting to remove it
GLib.source_remove(self._idle_draw_id)
/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_gtk3.py:181: Warning: Source ID 9 was not found when attempting to remove it
GLib.source_remove(self._idle_draw_id)
/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_gtk3.py:181: Warning: Source ID 10 was not found when attempting to remove it
GLib.source_remove(self._idle_draw_id)

so, i can't use this :(
please fix it

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.